表单身份验证,允许/被所有人看到
本文关键字:所有人 身份验证 允许 表单 | 更新日期: 2023-09-27 18:37:01
我正在使用表单身份验证来保护我的应用程序。
我在 web.config 中有以下内容:
<authentication mode="Forms">
<forms loginUrl="Login.aspx" name="ProjectName" defaultUrl="Users.aspx" slidingExpiration="true" timeout="2000" path="/" />
</authentication>
<location path="default.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
这允许我访问 www.mysite.com/default.aspx,但我希望能够访问 www.mysite.com,但是当我尝试导航到该 URL 时,它会将我重定向到登录页面。
<location path="/">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
注意允许/拒绝元素:http://msdn.microsoft.com/en-us/library/8d82143t
<deny users="?" /> -- will deny access to all anonymous users, and redirect them to login page
<allow users="*" /> -- will allow access to all users, even anonymous, without redirect to login page.
和<位置>:位置>
<location path="/">
路径可能在哪里:
"/" - is for root dir(and inner)
"file_or_dir" - restricts only the specified file or directory