Checking user access permissions to a virtual path in medium trust
-
23-06-2022 - |
Question
If I wanted to check whether the current user has access to a given url in full trust I can use code like this.
IPrincipal user = context.User
?? new GenericPrincipal(new GenericIdentity(
string.Empty,
string.Empty),
new string[0]);
UrlAuthorizationModule.CheckUrlAccessForPrincipal(virtualPath, user, "GET");
Unfortunately this does not work in a medium trust environment as the CheckUrlAccessForPrincipal
method has the following flags.
[SecurityPermission(SecurityAction.Demand, Unrestricted=true)]
Is there a way I can check whether the virtual path user permission in a medium trust? I'm rewriting a path in a HttpModules PostAuthorizeRequest
event handler so I need to be able to check permissions after the rewrite.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow