I am using the .NET framework 4.5
I have set the sessionState to expire after 60 minutes. Every pages that require to be "logged" inherits from a class named BasePage.cs. On the OnPreInit event, this class verify the Session object and redirect to the login page when the session is expired.
Here is the configuration of the sessionState (web.config) :
<sessionState timeout="60"/>
Here is my verification in the class "BasePage.cs" :
protected override void OnPreInit(EventArgs e)
{
if (HttpContext.Current.Session["infosession"] == null)
{
Response.Redirect("default.aspx");
}
}
This verification is working great when the user is navigating trough the pages.
In some pages, I am using a WCF Service (Ajax-enabled) called from javascript. Between the time the pages will be generated and the time the WCF Service will be called, the session may expire. Given that I should not assume that my Wcf Service's consumer will be a particular kind of software or have certain capabilities, as been a web browser, I can't do the verification there.
So after some explanations, here the question :
Is it possible, when the session expire (after 60 mins), to redirect automatically to the login page ?