I have a asp.net 4.0 site that uses the built in membership provider. I have had everything setup and working for quite a while. Now after my hosting provider moving my account to a different server, I can't log into one of my sites....
When I login, it redirects to the home page (as it should with a successful login). The SQL membership DB show a 'last login' as the current date/time.
However, the LoginStatus control still displays "Login" and my code "If Page.User.Identity.IsAuthenticated Then" returns false.
Why is it storing in the DB that the user logged in, but not actually logging the user in.....
Here is my membership provider from the root web.config:
It's because the request coming in to login is originally unauthenticated. The response has the authentication cookie so it won't be until the next request where the request is authenticated. My suggestion: on the login page once the user is logged in redirect
them back to the home page.
The login page does redirect to the homepage once the user has successfully logged in so therefore there is already a new request that should be authenicating the login.....
The login page does redirect to the homepage once the user has successfully logged in so therefore there is already a new request that should be authenicating the login.....
Anyone know of a possible solution to this? It is redirecting to the approprate paged. The Membership DB show the "last login" date/time as the approporate time, but the user is not signed into the site....
I think you're going to need to debug this at a lower level -- check the cookie at the network level, etc. If that doesn't get you anywhere, then repro the problem with a new project and/or a new app in IIS. So many moving parts... do what a dev does and
debug it :)
RDO
Member
309 Points
282 Posts
Problem logging into site
Jan 09, 2013 03:21 PM|LINK
Hello everyone,
I have a asp.net 4.0 site that uses the built in membership provider. I have had everything setup and working for quite a while. Now after my hosting provider moving my account to a different server, I can't log into one of my sites....
When I login, it redirects to the home page (as it should with a successful login). The SQL membership DB show a 'last login' as the current date/time.
However, the LoginStatus control still displays "Login" and my code "If Page.User.Identity.IsAuthenticated Then" returns false.
Why is it storing in the DB that the user logged in, but not actually logging the user in.....
Here is my membership provider from the root web.config:
<membership defaultProvider="MyMembershipProvider" userIsOnlineTimeWindow="15"> <providers> <remove name="AspNetSqlMembershipProvider"/> <remove name="MyMembershipProvider"/> <add name="MyMembershipProvider" type="System.Web.Security.SqlMembershipProvider" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="6" connectionStringName="MembershipConnection" applicationName="/domain.net" /> </providers> </membership> <roleManager enabled="true" defaultProvider="MyRoleProvider"> <providers> <remove name="AspNetSqlRoleProvider"/> <remove name="AspNetWindowsTokenRoleProvider"/> <add name="MyRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="MembershipConnection"/> </providers> </roleManager> <profile defaultProvider="MyProfileProvider"> <properties> <add name="FirstName"/> <add name="LastName"/> <add name="PhoneNum"/> <add name="MobileNum"/> </properties> <providers> <remove name="AspNetSqlProfileProvider"/> <add name="MyProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="MembershipConnection"/> </providers> </profile>Christian Forum
BrockAllen
All-Star
27434 Points
4891 Posts
MVP
Re: Problem logging into site
Jan 09, 2013 03:31 PM|LINK
It's because the request coming in to login is originally unauthenticated. The response has the authentication cookie so it won't be until the next request where the request is authenticated. My suggestion: on the login page once the user is logged in redirect them back to the home page.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
RDO
Member
309 Points
282 Posts
Re: Problem logging into site
Jan 09, 2013 03:51 PM|LINK
The login page does redirect to the homepage once the user has successfully logged in so therefore there is already a new request that should be authenicating the login.....
Christian Forum
mitaGreen
Member
188 Points
34 Posts
Re: Problem logging into site
Jan 11, 2013 11:08 AM|LINK
Hi,
It is strange.
RDO
Member
309 Points
282 Posts
Re: Problem logging into site
Jan 11, 2013 11:12 AM|LINK
I agree.....
Anyone have any ideas how to fix it?
Christian Forum
RDO
Member
309 Points
282 Posts
Re: Problem logging into site
Jan 19, 2013 05:52 PM|LINK
Bump...
Anyone know of a possible solution to this? It is redirecting to the approprate paged. The Membership DB show the "last login" date/time as the approporate time, but the user is not signed into the site....
Thanks!
Christian Forum
BrockAllen
All-Star
27434 Points
4891 Posts
MVP
Re: Problem logging into site
Jan 20, 2013 12:55 AM|LINK
I think you're going to need to debug this at a lower level -- check the cookie at the network level, etc. If that doesn't get you anywhere, then repro the problem with a new project and/or a new app in IIS. So many moving parts... do what a dev does and debug it :)
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/