Hi guys need help
I have Created AccountController with Register action Method
public ActionResult Register()
{
return View();
}
and on Logon View I have created link for Ragister
@Html.ActionLink("Register", "Register","Account")
But when I click on Register Link it redirect wrong like this
http://localhost:8090/Account/LogOn?ReturnUrl=%2fAccount%2fRegister
instead of
http://localhost:8090/Account/Register
I will appreciate your help
Thank you in advance
Jignesh TrivediPosted Apr 17, 2014, 9:07 AM
Hi,
This is due to your page required authenticated request....
so you have to bypass this register route.
are you mark your action method with Authorize attribute?
saurabh mittalPosted Apr 17, 2014, 8:38 AM
this is giving error because by default it will take index method.if u want to change this
than go to global.asac.cs page and change in this
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
in this change put action name AS register and controller name AS Account AS u shown in question
than it will run.may be it will help u.