model view controller - Session time out error -
my application expiring before 20 minutes , when working on expiring may know have 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" />
Comments
Post a Comment