Session time out error

48 views Asked by At

My application is expiring before 20 minutes and even when we are working on it also it is expiring may I know what I have to change?..

 public class CheckSessionOutAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        HttpContext ctx = HttpContext.Current;

        if (ctx.Session != null)
        {
            if (ctx.Session.IsNewSession)
            {
                string sessionCookie = ctx.Request.Headers["Cookie"];
                if ((null != sessionCookie) && (sessionCookie.IndexOf("ASP.NET_SessionId") >= 0))
                {
                    if (ctx.Request.IsAuthenticated)
                    {
                        FormsAuthentication.SignOut();
                        HttpContext.Current.Session.Clear();
                        RedirectResult redirectingto = new RedirectResult("~/Account/Timeout");
                        filterContext.Result = redirectingto;
                    }
                    else
                    {
                        string loginUrl = FormsAuthentication.LoginUrl;
                        RedirectResult redirectto = new RedirectResult(loginUrl);
                        filterContext.Result = redirectto;
                    }
                }
            }
        }
        base.OnActionExecuting(filterContext);
}

Web.config file

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" timeout="1000"/>
</authentication>
<sessionState  mode="InProc" timeout="20" />
0

There are 0 answers