This question already has an answer here:

After Logout from Application when i am trying to access home page without login and click on any menue item.

public ActionResult StudentList()
{
    if (UserRole.Students == 0)
        return RedirectToAction("Index", "Home");

    StudentRepo strepo = new StudentRepo();
    List<tblStudent> stdlist = strepo.getstudentlist();
    ViewBag.stdlist = stdlist;
    return View();
}

Related posts

Recent Viewed