Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with Login control of ASP.NET

Tags:

asp.net

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, with the correct connection string, and the authentication mode is set to Forms. Created some users to test with.

I created a Login.aspx and put the Login control on it. Everything works fine until the point that a user can log in.

I call Default.aspx, it gets redirected to Login.aspx, I enter the user and the correct password. No error message, nothing seems to be wrong, but I see again the Login form, to enter the user's login information. However if I check the cookies in the browser, I can see that the cookie with the specified name exists.

I already tried to handle the events by myself and check, what is happening in them, but no success.

I'm using VS2008, Website in filesystem, SQL Express 2005 to store aspnetdb, no role management, tested with K-Meleon, IE7.0 and Chrome.

Any ideas?

Resolution: After some mailing with Rob we have the ideal solution, which is now the accepted answer.

like image 410
Biri Avatar asked Sep 15 '08 09:09

Biri


1 Answers

RE: The Accepted Answer

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;
}
like image 115
Rob Cooper Avatar answered Sep 28 '22 17:09

Rob Cooper