how to RedirectToAction to home page?
How to red开发者_如何学编程irect a page to home page?
if (p == -1)
return RedirectToAction("Index");
this opens webpage like http://abc.com/Index in url
i want just http://abc.comOff the top of my head
return Redirect("~");
You shoul have correct routing with default values in your Global.asax.cs file. For example
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
and after that
if (p == -1)
return RedirectToAction("Index", "Home");
精彩评论