![](/img/trans.png)
[英]How to skip ASP.Net form authentication of parent website on some ASP.Net MVC action of child website
[英]How to skip forms authentication to some controller actions in asp.net MVC
在我的asp.net mvc Web應用程序中,我在web.config文件中指定了表單身份驗證。 如下所示
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
現在我正在創建一個不需要任何身份驗證的用戶激活頁面。 帳戶控制器中存在用戶激活操作方法。 當用戶輸入www.myweb.com/account/useractivation時我想打開頁面而不進行任何身份驗證。 任何人都可以在這方面幫助我。 我確實花了一些時間研究,但沒有運氣
使用[AllowAnonymous]
屬性裝飾需要繞過身份驗證的控制器或操作方法。
[AllowAnonymous]
public ActionResult Login(string returnUrl)
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel model, string returnUrl)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.