Checking user access permissions to a virtual path in medium trust
-
23-06-2022 - |
문제
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.
올바른 솔루션이 없습니다
제휴하지 않습니다 StackOverflow