Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>EDIT</strong></p> <p>Based on your comment, I would suggest handling this via a custom base controller that all of your other controllers would derive from. Have the custom base controller override OnActionExecuting and check for an expired state. If the state is expired, remove the authentication cookie from the response (FormsAuthentication.SignOut) and set the Result property on the ActionExecutingContext parameter to HttpUnauthorizedResult. Alternatively, you could simply redirect to a Logout action.</p> <p>You should also make sure that your session timeout and the forms authentication cookie timeout are the same.</p> <p><strong>Original answer left for context</strong></p> <p>I'm not sure exactly what you're asking. When the server session expires, the authentication ticket in the cookie is no longer valid. Any action that requires authorization (which minimally requires authentication) should get back an HttpUnauthorizedResult, which by default redirects to the Forms logon page.</p> <p>Are you asking how to expire the session on the client-side so that the client does something even in the absence of a request? If so, you might be interested in how I handle this via javascript/ajax. See my blog post on <a href="http://farm-fresh-code.blogspot.com/2009/05/client-side-session-termination.html" rel="nofollow noreferrer">client-side session termination</a> at <a href="http://farm-fresh-code.blogspot.com" rel="nofollow noreferrer">http://farm-fresh-code.blogspot.com</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload