我有这个 web.config
<location path="SomeDir/SomeSubDir">
<system.web>
<authorization>
<deny users="*"/>
</authorization>
</system.web>
</location>
如何更改此规则,以便仅当应用程序不在本地主机上运行时才应用此规则?有没有一种方法可以使规则检测环境?
我将从web.config中删除拒绝,并在页面加载事件中使用类似这样的东西。
if(!HttpContext.Current.Request.IsLocal && !User.Identity.IsAuthenticated)
Response.Redirect("Login.aspx");
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句