0

i am using form authentication but some time i notice user authentication is lived but my session expire. So guide me how to set same expiring time for both.

if i store something in session variable after login that will set to null if my session timeout occur?

this way i check before allowing to execute other code in server side function.

if (HttpContext.Current.User.Identity.IsAuthenticated && HttpContext.Current.Session["Email"] != null)
{

}

if always check before accessing few server side method that if user is authenticated and HttpContext.Current.Session["Email"] is not null then i allow to made the call of those few function. i saw IsAuthenticated is returning true but HttpContext.Current.Session["Email"] is getting null.

how to handle this situation. looking for your guide line. thanks

Mou
  • 15,673
  • 43
  • 156
  • 275
  • Check the following page, it may provide you some good clues: http://stackoverflow.com/questions/4605161/session-variables-timeout-in-asp-net-app – NP3 Dec 04 '14 at 12:28
  • http://stackoverflow.com/questions/1490879/detecting-session-expiry-on-asp-net-mvc?rq=1 – Mou Dec 04 '14 at 13:28

1 Answers1

0

HttpContext.Current.User.Identity.IsAuthenticated always returns true

i had the same probléme but i corrected it by setting a session in the logging form example session("user")=userid

i added this code in my master page

if isnothing(session("user")) then
redirect to login page
end if
SyMo7amed
  • 368
  • 2
  • 15