I am facing an un-recognized error in Asp.net MVC 3.0 while using authorize attribute.
accountController
public ActionResult LogOn()
{
return View();
}
testController
[Authorize]
public ActionResult Index()
{
return View();
}
Webconfig
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="1440" />
</authentication>
now while accessing the http://www.abc.com/test
Error: http://www.abc.com/Account/Login?ReturnUrl=%2ftest
it should redirect to account/logon but its not. Why?
For solution i have just added a new route url in global.asax.cs routes.MapRoute("auth", "account/login", new { Controller = "account", action = "logon" });
For reference i have checked this and this
Is this a bug or something is missing from my side?