0

我有一个 MVC Web 应用程序。它使用表单身份验证。

<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="90" />
</authentication>

我怎样才能绕过这个单一的路线,比如 xyz.com/us/ht/ht?

我想绕过整个功能以防止获取 aspxanonymous cookie,并且我不想在此路由的成员数据库中输入条目。

4

2 回答 2

0

解决此问题的一种方法是为路由 /us/ht/ht/ 使用自定义 AnonymousIdentificationModule。

东西在这里处理->

System.Web.Security.AnonymousIdetificationModule

于 2013-02-25T14:01:20.883 回答
0

如果您使用的是 MVC4,只需将[AllowAnonymous]标签添加到您的控制器操作中。

否则在你的 web.config 中这样做

<configuration>
   <location path="route/thatanon/isallowed">
      <system.web>
         <authorization>
            <allow users="?"/>
         </authorization>
      </system.web>
   </location>
</configuration>
于 2013-02-25T11:49:22.817 回答