Hamid
Hamid

Reputation: 15

How can set different session timeout

How we can set different session timeout in each part of a website in asp.net c#.

I know that we can manage session timeout by web config but when we change session timeout in web config the specified value set for all of my website but I want to manage session timeout in my program for example in administrator want to set session timeout 2 hours and in login user area set session timeout to 10 minute.

Upvotes: 0

Views: 10438

Answers (1)

disperate
disperate

Reputation: 54

You can change the SessionTimeout of the current HttpContext. When an administrator logs in, just change his timeout like this:

HttpContext.Current.Session.Timeout = 60;

http://forums.asp.net/t/1563991.aspx

Upvotes: 3

Related Questions