gpt4 book ai didi

asp.net - 以编程方式获取当前的 ASP.NET 信任级别

转载 作者:行者123 更新时间:2023-12-03 14:48:33 25 4
gpt4 key购买 nike

是否有用于获取当前 ASP.NET 信任级别的 API?

最佳答案

来自 dmitryr's blog :

AspNetHostingPermissionLevel GetCurrentTrustLevel() {
foreach (AspNetHostingPermissionLevel trustLevel in
new AspNetHostingPermissionLevel [] {
AspNetHostingPermissionLevel.Unrestricted,
AspNetHostingPermissionLevel.High,
AspNetHostingPermissionLevel.Medium,
AspNetHostingPermissionLevel.Low,
AspNetHostingPermissionLevel.Minimal
} ) {
try {
new AspNetHostingPermission(trustLevel).Demand();
}
catch (System.Security.SecurityException ) {
continue;
}

return trustLevel;
}

return AspNetHostingPermissionLevel.None;
}

关于asp.net - 以编程方式获取当前的 ASP.NET 信任级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1064274/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com