asp.net mvc - How to skip controller name while using RedirectToAction? -


i have accountcontroller class , have login & home views.

     [handleerror]     public class accountcontroller : controller     {         [httppost]         public actionresult login(loginmodal model, string returnurl)         {              //authentication              return redirecttoaction("home");          }         public actionresult home()         {              return view();          }     }  ------------------------------ ----------------------------- global.asax have route entry.. urls  http://lmenaria.com/login http://lmenaria.com/home  routes.maproute(null, "home", new { controller = "account", action = "home" }); routes.maproute(null, "login", new { controller = "account", action = "login" });  

when tried both url on browser working fine. when login success go http://lmenaria.com/account/home how can remove "account" url. going when used return redirecttoaction("home"); , getting 404 error.

so please let me know how can resolved issue. don't need controller name in url.

thanks laxmilal menaria

routes.maproute("home", "home", new { controller = "account", action = "home" });

i tried above maproute & use redirecttoroute instead of redirecttoaction , work.

thanks.


Comments