Last post Jul 17, 2014 08:36 AM by Luckbox72
Jul 16, 2014 12:45 PM|Luckbox72|LINK
I have a site that is using a session cookie to keep a few pieces of information but for some reason it seems to get removed before the time out.
In the global.asax I have
void Session_Start(object sender, EventArgs e)
HttpCookie jobTrax = Request.Cookies.Get("JobTrax");
if ((null != jobTrax))
if (Request.Cookies["JobTrax"] != null)
HttpCookie myCookie = new HttpCookie("JobTrax");
myCookie.Expires = DateTime.Now.AddDays(-1d);
and in the web.config I have SessionState timeout = 30
This works perfectly when I am in my local environment but when I move the web forms app to either our test or development servers after about 2 minutes of no activity if I click a button or do anything on the site I get redirected to the login screen.
I am using asp.net 4.5 with the new identity. an I do not have the <authentication> tag in my web.config. Is it possible my authentication is timing out and that is what is causing the redirect to my login screen which then removes my cookie?
Jul 16, 2014 03:17 PM|Luckbox72|LINK
Ok in my web.config I have added
<remove name="FormsAuthentication" />
then in Startup.Auth.cs I have
public void ConfigureAuth(IAppBuilder app)
// Enable the application to use a cookie to store information for the signed in user
// and also store information about a user logging in with a third party login provider.
// This is required if your application allows users to login
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
ExpireTimeSpan = TimeSpan.FromMinutes(30)
For some reason I am still getting a timeout after about 2 min. I was assuming my authorization was timing out that was causing the app to go to the login screen, which would then remove the cookie.
Jul 17, 2014 03:39 AM|Shawn - MSFT|LINK
For this situation, it may be a Idle timeout setting problem. Timeout has
Session Timeout and Idle Timeout. Session timeout is set from web.config and from iis too. Default timeout is 20 minutes if you want more than that set in your session state. Idle timeout only set from iis, you could check within
the iis settings:
For more information, you could refer to:
Jul 17, 2014 08:36 AM|Luckbox72|LINK
That was it. Somehow the Idle Timeout was set to 1 min.