允许未经身份验证的用户使用ASP.Net表单身份验证访问特定页面
发布时间:2020-12-15 19:04:26 所属栏目:asp.Net 来源:网络整理
导读:我使用ASP.Net表单验证。我的Web.config看起来像这样。 authentication mode="Forms" forms loginUrl="login.aspx"/ /authentication authorization deny users="?" / /authorization 因此,目前每个aspx页面都需要身份验证。 我想允许甚至未经身份验证的用
我使用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 – 如何为Bootstrap按钮创建Button_Click()事件?
- asp.net-mvc – ASP.NET MVC是否为区域创建默认路由
- Asp.Net MVC EF各版本区别
- 如何将作为ASP.NET图像控件提供的图像居中?
- asp.net-mvc – 流畅的验证自定义验证规则
- ASP.NET C# 连接 Oracle数据库增删改查,事务
- asp.net-mvc – 一种在ASP.NET MVC中排除操作过滤器的方法?
- .net – 存储加密密钥的位置
- iis – 是否需要serviceAutoStartProvider属性来自动启动AS
- asp.net-mvc – 如何在ASP.NET MVC中传递页面的元标记?