The ActionResult can take different values like View , PartialView, String etc,
Another value that it can take is HttpUnauthorizedResult . The HttpUnauthorizedResult when returned from a View will force the user to login in.
HttpUnauthorizedResult in ASP.NET MVC
public ActionResult Index()
{
//var states = ModelState.Values;
//// Error States
//var errorsStates = from m in states
// select m.Errors;
return new HttpUnauthorizedResult();
}
2 comments
Interesting .NET Links - February 22 , 2013 | TechBlog
Feb 22, 2013
[...] HttpUnauthorizedResult in ASP.NET MVC – AbundantCode [...]
Interesting .NET Links - March 5 , 2013 | TechBlog
Mar 5, 2013
[...] HttpUnauthorizedResult in ASP.NET MVC – AbundantCode.com [...]