Setting a custom view of 401 error in Windows Authentication mode for an MVC application

My MVC app is installed in windows authentication mode.

I would like to provide a custom view / 401 error page when an unauthorized user tries to access some resource in my application instead of the default IIS page.

I decorate mine with the Action

following attributes:

[HttpGet]
[Authorized(Roles="Admin")]
public ActionResult Add()
{
  return View();
}

      

How can I do this in MVC?

Thank,

+3


source to share


1 answer


Check out this answer . This points to a good article and you will find a couple of suggestions to help you



+1


source







All Articles