Asp.net 拒绝用户访问位置路径
我想拒绝所有用户访问此页面,但它给了我以下错误:Asp.net 拒绝用户访问位置路径,asp.net,web-config,Asp.net,Web Config,我想拒绝所有用户访问此页面,但它给了我以下错误: <location> path attribute must be a relative virtual path. It cannot contain any of '?' ':' '\' '*' '"' '<' '>' or '|' path属性必须是相对虚拟路径。它不能包含任何“?”:“\*”''或“|” 以下是我的web.config文件代码: </configuration> <locat
<location> path attribute must be a relative virtual path. It cannot contain any of '?' ':' '\' '*' '"' '<' '>' or '|'
path属性必须是相对虚拟路径。它不能包含任何“?”:“\*”''或“|”
以下是我的web.config文件代码:
</configuration>
<location path="http://10.19.13.68/Dashboardviewer/Imv.aspx">
<system.web>
<authorization>
<deny users="*"/>
</authorization>
</system.web>
</location>
</configuration>
使用下面的代码,它可能会对您有所帮助():
//这将限制匿名用户访问
**//此处的路径是指向register.aspx页面的路径,例如,它可以是~/publicpages/register.aspx**
//这将允许所有人访问register.aspx
但它仍然允许用户访问页面这里是我的代码现在。。。
<configuration> <system.web>
<authentication mode="Forms"/>
<authorization> <deny users="?"/> //this will restrict anonymous user access
</authorization> </system.web>
<location path="register.aspx"> **//path here is path to your register.aspx page e.g. it could be ~/publicpages/register.aspx**
<system.web>
<authorization>
<allow users="*"/> // this will allow access to everyone to register.aspx
</authorization>
</system.web> </location> </configuration>