@{
    if (Session["LoginType"] == null)
    {
       Response.Redirect("~/Account/Login", true);
    }

}

If the Session expires, the Session["LoginType"] becomes null. I can catch that. But the next line to redirect to the login page again, doesn't work. Yellow code line in break mode just stops on it, then moves on to next lines of code (that gives an error because the Session["LoginType"] is null.

Any ideas? Am I coding this wrong? Not really an expert at this MVC/Razor stuff.

Related posts

Recent Viewed