get returning user for forms auth?

  • Thread starter Sergei Shelukhin
  • Start date
S

Sergei Shelukhin

Hi. I have the following scenario; user logs in using standard login
control for forms auth, I validate his credentials against the
database, optionally make the cookie persistent and then set some
application-specific session variables for that user.

Now, when the user closes the browser and returns to the site again
the next day, he will be authenticated if he had logged in previously
w/the checkbox check.
The problem is, I need to initialize the session variables for that
user again when he reenters the site; I pondered checking auth cookie
manually, decrypting the ticket and getting username etc; however that
doesn't seem right. How do I find out that authenticated user is re-
entering the site (in Session_Start event I guess)?
 
G

Guest

Hi. I have the following scenario; user logs in using standard login
control for forms auth, I validate his credentials against the
database, optionally make the cookie persistent and then set some
application-specific session variables for that user.

Now, when the user closes the browser and returns to the site again
the next day, he will be authenticated if he had logged in previously
w/the checkbox check.
The problem is, I need to initialize the session variables for that
user again when he reenters the site; I pondered checking auth cookie
manually, decrypting the ticket and getting username etc; however that
doesn't seem right. How do I find out that authenticated user is re-
entering the site (in Session_Start event I guess)?

protected void Session_Start(object sender, EventArgs e)
{
if (Request.IsAuthenticated)
{
Session["CurrentUser"] = User.Identity.Name;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top