How to detect that session time out automatically and redirect to login Action in asp.net MVC once session end ?
I tried to redirect to login action from Session_End() method but it not working
protected void Session_End(Object sender, EventArgs e)
{
object USerID = this.Session["sessionUserID"];
if (USerID!=null)
{
int result = BLL.Base.UserBLL.LogOut(int.Parse(USerID.ToString()),true);
Session.Clear();
}
}
You can do this with the Action filter
Now you can use at specific action or at controller level