eto*_*bot 43 asp.net forms-authentication
我正在使用ASP.Net Forms身份验证.我的Web.config看起来像这样.
<authentication mode="Forms">
<forms loginUrl="login.aspx"/>
</authentication>
<authorization>
<deny users="?" />
</authorization>
Run Code Online (Sandbox Code Playgroud)
所以目前每个aspx页面都需要身份验证.
我想允许甚至未经身份验证的用户访问名为special.aspx的特定页面.我怎样才能做到这一点?
Cha*_*ell 55
看看MS支持上的示例
<configuration>
<system.web>
<authentication mode="Forms" >
<forms loginUrl="login.aspx" name=".ASPNETAUTH" protection="None" path="/" timeout="20" >
</forms>
</authentication>
<!-- This section denies access to all files in this
application except for those that you have not explicitly
specified by using another setting. -->
<authorization>
<deny users="?" />
</authorization>
</system.web>
<!-- This section gives the unauthenticated
user access to the ThePageThatUnauthenticatedUsersCanVisit.aspx
page only. It is located in the same folder
as this configuration file. -->
<location path="ThePageThatUnauthenticatedUsersCanVisit.aspx">
<system.web>
<authorization>
<allow users ="*" />
</authorization>
</system.web>
</location>
<!-- This section gives the unauthenticated
user access to all of the files that are stored
in the TheDirectoryThatUnauthenticatedUsersCanVisit folder. -->
<location path="TheDirectoryThatUnauthenticatedUsersCanVisit">
<system.web>
<authorization>
<allow users ="*" />
</authorization>
</system.web>
</location>
</configuration>
Run Code Online (Sandbox Code Playgroud)
pat*_*ech 18
将以下内容放在web.config中:
<location path="special.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
65107 次 |
最近记录: |