Bug #36938 | 'Not authorized' redirects, but should set http status to 403 | ||
---|---|---|---|
Submitted: | 24 May 2008 13:35 | Modified: | 29 May 2008 22:51 |
Reporter: | Poul Bak | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / NET | Severity: | S4 (Feature request) |
Version: | 5.2.2 | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | authentication, authorization, membershipmanager, rolemanager |
[24 May 2008 13:35]
Poul Bak
[29 May 2008 22:51]
Poul Bak
I have just found out, that FormsAuthentication is the cause of this. My workaround: Subscribe to PostAuthenticateRequest event and call: private void CheckNotAuthorized(HttpContext context) { if ((context.User != null) && (context.User.Identity != null) && context.User.Identity.IsAuthenticated && !UrlAuthorizationModule.CheckUrlAccessForPrincipal(context.Request.AppRelativeCurrentExecutionFilePath, context.User, context.Request.HttpMethod)) { throw new HttpException(403, Resources.Statuskoder.Status403); } }