HttpUnauthorizedResult in ASP.NET MVC

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();

}