I basically want to check if the session is still valid for every GET and POST request in my application, however, I don't really want to keep copying and pasting the same code in to every Action Method, I was thinking of using a Base Controller so I can inherit the usage or a static helper controller class (if this can be done??). Are either of these ways the best (or even correct) approach to take?
Example of code
[HttpGet]
[ValidateInput(false)]
public ActionResult SimpleSearch()
{
// I want to run this code of every ActionResult for a GET AND POST
if (!SessionStaticClass.IsUserLoggedIn())
{
return RedirectToAction("Login, Login");
}
}
Thanks