除一页外的表单认证

Form authentication except for one page

您好,我正在使用 MVC 创建一个小型网站,我有大约三个页面,我正在尝试允许特定页面上的所有用户访问。该页面是在我的 "HomeController index".

中创建的
<system.web>
  <authentication mode="Forms">
    <forms defaultUrl="~/" loginUrl="~/Account/Login" name="Test" timeout="10080">
    </forms>
   </authentication>
</system.web>
</system.web>
  <location path="Home">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
<system.webServer>

这是我的网络配置,但当我尝试继续 /home 时它仍然会重定向我

在控制器操作上方添加 [AllowAnonymous] 属性。

public class HomeController : Controller 
{
     [AllowAnonymous]
     public ActionResult Index()
     {

     }
}