表单身份验证web.config设置 [英] Forms Authentication web.config set up
本文介绍了表单身份验证web.config设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
该规范在根web.config文件中是否正确?我没有在受保护的文件夹中使用子级web.config.
Is this specification correct in the root web.config file? I haven't used a child web.config in the protected folder.
<system.web>
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="">
</forms>
</authentication>
</system.web>
然后在根web.config中也有另一个有关system.web的规范:
Then another specification for system.web also in root web.config:
<location path="to protected folder">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
推荐答案
您应使用以下元素设置web.config.
You should setup the web.config with the following elements.
<configuration>
<system.web>
<authentication mode="Forms">
<forms name="SiteName" path="/" loginUrl="~/Login.aspx" protection="All" timeout="30" />
</authentication>
</system.web>
</configuration>
您可以通过放置拒绝匿名访问的web.config来保护文件夹.
You can protect folders by placing a web.config that denies anonymous access.
<configuration>
<system.web>
<!-- Place in a sub folder that you want to protect using Forms Authentication -->
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>
这篇关于表单身份验证web.config设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文