SessionState Expired

Is it possible to control ASP.NET behavior when Sessionexpired? It seems that the default behavior sends the user to the root site. The desired result would be to send the user to the user page "Session Expired".

To clarify, the time is running out SessionState(set the wait time to 1 minute to quickly test it):

<sessionState mode="InProc" timeout="1"></sessionState>

The authentication cookie timeout is much higher to avoid confusion:

<authentication mode="Forms">
    <forms loginUrl="SessionExpired.aspx" slidingExpiration="true" name=".ttpASPXAUTH" timeout="58" protection="All"></forms>
</authentication>
+3
source share
2 answers

/ , - , , - Application_AcquireRequestState Global.asax, , , .

0

global.asax Session_Start.

- :

if (!Request.Url.AbsolutePath.EndsWith("DEFAULT.ASPX", _
              StringComparison.InvariantCultureIgnoreCase))
{
    string newPage = string.Format("ErrorPage.aspx?ErrorMessage={0}", _
              System.Uri.EscapeUriString("Your session has expired."));
    Logger.InfoFormat("{0} Session expired or illegal page access attempted: {1}", _
              Utility.StoreRegisterForLog, Request.Url.ToString());
    Response.Redirect(newPage);
}

, , .

0

Source: https://habr.com/ru/post/1765128/


All Articles