允许未经身份验证的用户使用ASP.Net表单身份验证访问特定页面
发布时间:2020-05-23 07:58:20 所属栏目:asp.Net 来源:互联网
导读:我使用ASP.Net表单验证。我的Web.config看起来像这样。 authentication mode=Forms forms loginUrl=login.aspx/ /authentication authorization deny users=? / /authorization 因此,目前每个asp
|
我使用ASP.Net表单验证。我的Web.config看起来像这样。 <authentication mode="Forms">
<forms loginUrl="login.aspx"/>
</authentication>
<authorization>
<deny users="?" />
</authorization>
因此,目前每个aspx页面都需要身份验证。 我想允许甚至未经身份验证的用户访问名为special.aspx的特定页面。 解决方法看看 MS Support的例子<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> (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – 自动插入HTML属性的双引号
- asp.net-mvc – .NET MVC / Entity Framework应用程序中的内
- asp.net-mvc – 使用JSON,JQuery向ASP.NET MVC Controller发
- asp.net – 如何从Date对象减去一个月?
- asp.net – 我可以通过编程方式禁用更新面板吗?
- asp.net-mvc – ASP.NET MVC使用相同的控制器分离移动视图
- asp.net – 在开发系统上禁用OutputCache
- asp.net-mvc-3 – 使用@ Html.Raw有风险吗?
- asp.net – 如何获得Google Prettify更像Visual Studio
- asp.net-mvc-3 – 使用Jquery Ajax渲染部分视图与变量数据
推荐文章
站长推荐
热点阅读
