It turns out my issue was being caused by my BaseController.cs
which all of my other controllers inherit from. It was redirecting to the login because of faulty validation logic, which I fixed.
Thank you all for the sensible suggestions.
Question
I have a Login page with a "Forgot Password" link, which is created using an <a>
tag with an href
attribute of @Url.Action("ForgotPassword", "Login", new { Area = "Admin" })
, and for some reason this link directs me to the login page instead of the ForgotPassword page.
Does anybody have a clue as to why this is? I have been investigating and found nothing strange in my project.
Another note: the "Index" action on my Login controller gets hit, but the "ForgotPassword" action never does.
Here's the ForgotPassword action:
[HttpGet]
public ActionResult ForgotPassword()
{
return View();
}
Solution 3
It turns out my issue was being caused by my BaseController.cs
which all of my other controllers inherit from. It was redirecting to the login because of faulty validation logic, which I fixed.
Thank you all for the sensible suggestions.
OTHER TIPS
If there is [Authorize]
attribute in Login
controller, move it and put it in actions which you want users can access who isAuthorized
.
This issue is not in @Url.Action. This is because you deny access to this action. May be you have [Authorize] attribute on your Login controller. If you don't want to delete [Authorize] attribute you can allow action in you web.config:
<configuration>
...
<location path="Login/ForgotPassword">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
...
</configuration>