Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 29, 2012 01:33 PM by BrockAllen
Member
117 Points
332 Posts
Dec 29, 2012 12:59 PM|LINK
For some reason this FormsAuthentication.Authenticate always returns false when I put in the correct details. However the
Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out status);
works and saves stuff in the db
public bool Authenticate(string username, string password, bool rememberMe) { bool result = FormsAuthentication.Authenticate(username, password); if (result) { FormsAuthentication.SetAuthCookie(username, rememberMe); } return result; }
I've set up the web confg like this;
<authentication mode="Forms"> <forms loginUrl="~/Account/LogOn" timeout="2880" /> </authentication> <membership> <providers> <clear /> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="AspMembership" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /> </providers> </membership> <profile> <providers> <clear /> <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="AspMembership" applicationName="/" /> </providers> </profile> <roleManager enabled="true"> <providers> <clear /> <add connectionStringName="AspMembership" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" /> <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" /> </providers> </roleManager>
74 Points
37 Posts
Dec 29, 2012 01:18 PM|LINK
Look this
http://blog.tutorem.com/post/2011/10/14/ASPNet-Security-Issue-FormsAuthenticationAuthenticate-Always-Returns-false.aspx
http://forums.asp.net/t/1331466.aspx/1
http://forums.asp.net/t/1354928.aspx/1
http://forums.asp.net/t/1016352.aspx/1
All-Star
27438 Points
4893 Posts
MVP
Dec 29, 2012 01:33 PM|LINK
FormsAuthentication.Authenticate doesn't use the provider model -- it checks usernames and passwords stored under the <forms> element in the .config file.
GorillaMann
Member
117 Points
332 Posts
FormsAuthentication.Authenticate always returns false with in asp mvc 4 project
Dec 29, 2012 12:59 PM|LINK
For some reason this FormsAuthentication.Authenticate always returns false when I put in the correct details. However the
Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null,
out status);
works and saves stuff in the db
public bool Authenticate(string username, string password, bool rememberMe) { bool result = FormsAuthentication.Authenticate(username, password); if (result) { FormsAuthentication.SetAuthCookie(username, rememberMe); } return result; }I've set up the web confg like this;
<authentication mode="Forms"> <forms loginUrl="~/Account/LogOn" timeout="2880" /> </authentication> <membership> <providers> <clear /> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="AspMembership" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /> </providers> </membership> <profile> <providers> <clear /> <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="AspMembership" applicationName="/" /> </providers> </profile> <roleManager enabled="true"> <providers> <clear /> <add connectionStringName="AspMembership" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" /> <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" /> </providers> </roleManager>dotnetramesh
Member
74 Points
37 Posts
Re: FormsAuthentication.Authenticate always returns false with in asp mvc 4 project
Dec 29, 2012 01:18 PM|LINK
Look this
http://blog.tutorem.com/post/2011/10/14/ASPNet-Security-Issue-FormsAuthenticationAuthenticate-Always-Returns-false.aspx
http://forums.asp.net/t/1331466.aspx/1
http://forums.asp.net/t/1354928.aspx/1
http://forums.asp.net/t/1016352.aspx/1
BrockAllen
All-Star
27438 Points
4893 Posts
MVP
Re: FormsAuthentication.Authenticate always returns false with in asp mvc 4 project
Dec 29, 2012 01:33 PM|LINK
FormsAuthentication.Authenticate doesn't use the provider model -- it checks usernames and passwords stored under the <forms> element in the .config file.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/