First, I created a Login page that added a key value pair to the session and verified that on that page the session holds that pair. Next, I attempt to go to another page that looks for that pair in the session and it is not there. I've put the timeout for the session to 15000 so it won't timeout. I currently use a static class to look at the session, HttpContext.Current.Session. Each Page calls this static class to look at the session but every time the session key count = 0 except after I the pair on the login page.
public static class UserAuthenticationManager
{
public static bool IsAuthenticated()
{
UserAuthenticationTicket ticket = ((UserAuthenticationTicket)HttpContext.Current.Session[DefinesPL.UserTicketSessionName]);
string redirectUrl = String.Format(DefinesPL.LoginPage);
if (ticket != null)
{
if (ticket.IsExpired())
{
HttpContext.Current.Session.Abandon();
HttpContext.Current.Response.Redirect(redirectUrl, true);
}
}
else
{
HttpContext.Current.Session.Abandon();
HttpContext.Current.Response.Redirect(redirectUrl, true);
}
return true;
}