Ich habe einen Link zu/ForgotPassword auf meiner Anmeldeseite. Wenn ich darauf klicke, werde ich einfach zu/Login? ReturnUrl =% 2fForgotPassword weitergeleitet. Dies ist eine MVC5-Anwendung mit formularbasierter Authentifizierung. Ich versuche, AllowAnonymous zu verwenden, aber es funktioniert nicht. Web Config:Ermöglichen Sie anonymen Zugriff auf ForgotPassword Seite
<location path=".">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
<location path="Content">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="Scripts">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="App_Themes">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<authentication mode="Forms">
<forms loginUrl="~/Login" timeout="15"/>
</authentication>
ForgotPassword Controller:
[AllowAnonymous]
public class ForgotPasswordController : Controller
{
[AllowAnonymous]
public ActionResult Index()
{
return View();
}
}
Schön wäre es. Abgesehen von einem _ViewStart kann ich nichts finden, was verwendet wird, das mit AllowAnonymous dekoriert werden sollte.
Was fehlt mir hier? Vielen Dank!