I set up a website to use SqlMembershipProvider as written on this page.
I followed every step. I have the database, I modified the Web.config to use this provider,
Try adding the path element. It must be the same as your virtual site path, for example if you test to /localhost/Authentication
path must be = "/Authentication"
<forms loginUrl="Login.aspx" protection="All" timeout="30" name="AuthTestCookie"
path="/Authentication" requireSSL="false" slidingExpiration="true"
defaultUrl="default.aspx" cookieless="UseCookies" enableCrossAppRedirects="false"/>
Have you checked that the redirect path is being sent to the login form? Off my head I think it is ReturnURL?
@Jon: I'm not using roles yet. If I check the Web Admin Tool, it says: Roles are not enabled .
@Rob: Yes, it is there.
I also checked the events in order: LoggingIn, Authenticate, LoggedIn, so it is following the correct path, but no redirect and it does not see that it was authenticated.
I know this is an old post, but I found an additional answer... For others in the future with this problem, I found that my web.config file somehow had the following added to the bottom (not sure how). Once I commented the out, it worked fine :) Even though I had everything above in the file set properly, this one line caused me over an hour of headache...
<system.webServer>
<modules>
<remove name="FormsAuthentication" />
</modules>
</system.webServer>
I do not like the hack given.
I have a site that uses a login form called "login.aspx" and all works fine. I think we should actually find the answer rather than hack. Since all the [presumably] tested sites work. Do you not think we should actually use StackOverflow to find the ACTUAL problem? (making it much more useful than anywhere else?)
In the LoginCtl_Authenticate event are you setting the EventArgs.Authenticated property to true?
e.g.
protected void LoginCtl_Authenticate(object sender, AuthenticateEventArgs e)
{
// Check the Credentials against DB
bool authed = DAL.Authenticate(user, pass);
e.Authenticated = authed;
}
What is the role of the username you are logging in with? Have you permitted this role to access Default.aspx?
I experienced this once (a long time ago) and went "doh!" when I realized that not even admin roles can access the main folder!