사용자가 권한이없는 영역에 사용자가 액세스하려고 시도 할 때마다 보안 예외를 발생시키고 싶습니다. AuthorizeAttribute가 제공하는 것보다 더 많은 컨트롤이 필요합니다. 액션 : 내가 가지고있는 것 : throw new HttpException((int)HttpStatusCode.Unauthorized, String.Empty);
이것은 404와 403을 위해 잘 작동합니다.MVC2에서의 Throwing 401
Description: An unhandled exception occurred during the
execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException:
401을 던질 수있는 방법이 있나요 또는 사용자 정의 (401)보기로 사용자를 리디렉션 단지 예이다 : 그러나 내가 대신 얻는 것은 500 오류입니다.