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.
I have checked the code over in the files you have sent me (thanks again for sending them through).
Note: I have not tested this since I have not installed the database etc..
However, I am pretty sure this is the issue.
You need to set the MembershipProvider Property for your ASP.NET controls. Making the definitions for them:
And..
This then binds the controls to the Membership Provider with the given name (which you have specified in the Web.Config.
Give this a whirl in your solution and let me know how you get on. I hope this works for you 🙂
Edit
I should also add, I know you shouldn’t need to do this as the default provider is set, but I have had problems in the past with this.. I ended up setting them all to manual and all worked fine.