ASP.NET MVC user friendly 401 error
问题 I have implemented errors handling in ASP.NET MVC site in a way like suggests this post. With 404 errors all works fine. But how correctly show user friendly screen for a 401 error ? They usually do not throw Exception that can be handled inside Application_Error() but rather action returns HttpUnauthorizedResult. One possible way is to add following code to the end of Application_EndRequest() method if (Context.Response.StatusCode == 401) { throw new HttpException(401, "You are not