【发布时间】:2012-05-30 06:11:31
【问题描述】:
我一直试图让 Forms Authenticaiton 在我的项目上工作,但无济于事。现在它只是本地的,我正在通过 Visual Studio 运行它。
第一次尝试(使用根目录 Web.Config):
<?xml version="1.0"?>
<configuration>
<location path="~/Account/Admin.aspx">
<system.web>
<authorization>
<deny users="*"/>
<allow users="*"/>
</authorization>
<authentication mode="Forms">
<forms loginUrl="Login.aspx" timeout="30" name=".ARBBADMIN" requireSSL="false" slidingExpiration="true" defaultUrl="default.aspx">
<credentials passwordFormat="Clear">
<user name="user1" password="pass1"/>
</credentials>
</forms>
</authentication>
</system.web>
</location>
</configuration>
不起作用,即使我尝试拒绝所有用户
第二个选项,我在帐户文件夹中放置了一个单独的 web.config,我收到此错误:
在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的部分是错误的。此错误可能是由于虚拟目录未在 IIS 中配置为应用程序所致。
我已经用谷歌搜索并研究过,解决方案是将文件夹设为 IIS 目录,我不知道在 localhost 上运行时该怎么做。 `
【问题讨论】:
标签: asp.net forms authentication