1

I have a permission based site that only allows certain users with roles access to specific pages. If you do not have the role associated to your account then you will get an unauthorised page. My problem is for my website (using mvc 4) that I seem to get a generic 401 page.

I want to change so I can see a custom 401 page using form authentication. I have created a view and set the page in custom errors but it keeps defaulting to the generic 401 page supplied by IIS and not the one specified in the controller / view.

James Andrew Smith
  • 1,516
  • 2
  • 23
  • 43
  • you can check that `Response.Status.Substring(0,3).Equals("401")` and then redirect to that particular View – CodingDefined Feb 02 '15 at 08:53
  • possible duplicate of [Custom ASP.NET MVC 404 Error Page](http://stackoverflow.com/questions/553922/custom-asp-net-mvc-404-error-page) – Ehsan Sajjad Feb 02 '15 at 09:21
  • If you've added the custom error page code in the `web.config` can you share you it so we can see where you're going wrong – Izzy Feb 02 '15 at 09:25
  • Possible duplicate of [ASP.NET MVC 404 Error Handling](https://stackoverflow.com/questions/717628/asp-net-mvc-404-error-handling) – Alexander Jul 02 '19 at 03:45

0 Answers0