0

How can I log a user on automatically once they have been identified with a cookie in C#?
Membership.ValidateUser("membersUsername","membersPassword") will let me know if it's a valid user but it won't log them on.

2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by edfinley
0

Depends how you are implementing your login structure. When a user is logged on, are you not assigning information to a session variable which indicates they are "logged on"?

0

I'm using the default membership provider that handles that, but I'm starting to think that it might be easier to validate the user and assign the session variable manually. What I am looking for is something like Membership.LoginUser("username", "password") but the default Membership provider does not make it that easy.

0

Jorge,
Thanks for the response.
I had gone through the tutorials you referenced and think Scott Mitchell is one of the best resources of information I've found. In his tutorials he still uses a login control and the Login_Authenticate method of his control, which he modifies to add some nice features. That still requires the user to be directed to a login page and click the login control to get to the Login_Authenticate method. I've tried calling the method and creating similar ones but can't find the right AuthenticateEventArgs to pass to it.
What I'm trying to do is have a user to go straight to a page that requires a login, identify him via a cookie from his last login, and log him in without him having to do anything else. I have everything done except for being able to log him in. Partly due to some of Scott Mitchell's tutorials I went with the default Membership provider but a simple task of logging someone in has been very elusive.
Regards,
Ed

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.