asp.Net   发布时间:2022-04-07  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了允许未经身份验证的用户使用ASP.Net表单身份验证访问特定页面大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用ASP.Net表单验证。我的Web.config看起来像这样
<authentication mode="Forms">
      <forms loginUrl="login.aspx"/>
    </authentication>
    <authorization>
      <deny users="?" />
    </authorization>

因此,目前每个aspx页面都需要身份验证。

我想允许甚至未经身份验证的用户访问名为special.aspx的特定页面。
我如何做到这一点?

@H_618_9@

解决方法

看看 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>
@H_618_9@ @H_618_9@

大佬总结

以上是大佬教程为你收集整理的允许未经身份验证的用户使用ASP.Net表单身份验证访问特定页面全部内容,希望文章能够帮你解决允许未经身份验证的用户使用ASP.Net表单身份验证访问特定页面所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。