0

My website hosted on server is logging out after 1 min of inactivity. I have set

<sessionState timeout="600"/>

in my web config. but how can i prevent idle time logout in my server. In my local machine it is working fine.

Hash
  • 11
  • 4
  • if you can change setting in IIS , also look at this thread https://stackoverflow.com/questions/39153581/how-do-you-change-session-timeout-in-iis-8-5 – AlexiAmni Aug 09 '18 at 07:44

1 Answers1

0

I set my timeout in the session_start using HttpContext.Current.Session.Timeout = 300;

In global.asax.cs add / edit the method Session_Start

void Session_Start(object sender, EventArgs e) { 
    HttpContext.Current.Session.Timeout = 300; 
}
Ron Splinter
  • 151
  • 3
  • 14
  • Yes it works great! I set the timeout for the visitors depending on the ip address. If it starts with 192.168 then it I set it to 300 minutes. Otherwise, it is a visitor from outside my company's network, I set it to 20 minutes. – Ron Splinter Aug 09 '18 at 07:34
  • In the file Global.asax.cs add the method void Session_Start(object sender, EventArgs e) { HttpContext.Current.Session.Timeout = 300; } – Ron Splinter Aug 09 '18 at 07:39