I am using VS 2013 Express for Web. I used to create a simple login exercise. When the user logs in, I create this form authentication in my login action method:
FormsAuthentication.SetAuthCookie(model.Name, false);
and immediately place the name into a session:
Session["name"] = model.name;
My session settings in the Web.config is as follows:
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="10"/>
</authentication>
<sessionState timeout="1" /> <!-- only one minute-->
After the assignment of the session variable, if I pause execution at a break point, shouldn't the Session time out after 1 minute and becomes empty? Currently, it continues having a value.
The value won't actually change whilst you're on a break-point, but you could set a break on the
Session_End
in the global.asax file to detect when the session times-out. Take a look at working with Global.asax file to understand the different events.