how to redirect to controller from global.asax when session end in mvc 4 c#

Last Reply 12 days ago By dharmendr

Posted 12 days ago

how to redirect to controller from global.asax when session end.

when session end i want to redirect to controller from global.asax using mvc 4 c#. I am trying the below code.but not working.any suggestions.

Here is my Global.asax.

 

 void Session_OnEnd(object sender, EventArgs e)
        {            
                Response.RedirectToRoute("logout", "Home");           
        }

 

You are viewing reply posted by: dharmendr 12 days ago.
Posted 12 days ago

Himanoj150,

Just apply the [SessionExpireFilter] attribute on each method where you want to ensure that our session is still valid.

[SessionExpireFilter]
public ActionResult Index( ) {
   // This method will not execute if our session has expired
   // render Home Page
   return View();
}

 

I agree, here is the link: http://e-iceblue.com/free-api