Reputation: 94
I am using "cookies" to maintain session in my asp.net azure application.
What I want is that when a user logs in to my website and remains idle for 15 minutes it should automatically log them out and redirect them to the login page.
How can I achieve this?
Upvotes: 0
Views: 1125
Reputation: 823
You can use Expires property of HttpCookie object:
HttpCookie SessionCookie = new HttpCookie("Session");
DateTime now = DateTime.Now;
SessionCookie.Expires = now.AddMinutes(15);
Response.Cookies.Add(SessionCookie);
Upvotes: 2
Reputation: 1880
In web.config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<sessionState timeout="15"/>
</system.web>
</configuration>
Upvotes: 2