元素身份验证不包含元素凭据



现在我读了一本弗里曼的书"ASP.NET MVC5",我尝试创建身份验证窗口。但是我已经像书中一样更改了文件 Web.config 并有错误。

<system.web>
    <customErrors mode="Off" />
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
      <credentials passwordFormat="Clear"> <!-- Error -->
        <user name="admin" password="secret" />
      </credentials>
    </authentication>
  </system.web>

错误:身份验证不包含元素凭据

凭据元素应位于表单元素中。像这样:

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" timeout="2880">
      <credentials passwordFormat="Clear"> <!-- Error -->
        <user name="admin" password="secret" />
      </credentials>
  </forms>
</authentication>als>

最新更新