All about Programming and Sourcecode

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

}
0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
 
Comments

Trackbacks for this post

Leave a Reply