When you use www.abc.com, the default route will run Home/Index action. To re-direct from there to index.htm, you have to use redirect to index.htm. The following code may help you:
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
return Redirect("index.htm");
}
ashuthinks
Member
87 Points
76 Posts
How do I redirect page in MVC3?
Feb 14, 2012 11:56 AM|LINK
I have created and host nvc3 web app now problem is when I open my
it is opening index.cshtml i.e home page of mvc web appbut I dont want that to be open when I open
I have one static page called should be open firstin mvc3 Global.asax code:
How can I render to
? what should I please help. </div>Mark as Answer if it helped!!! :)
abiruban
All-Star
16038 Points
2734 Posts
Re: How do I redirect page in MVC3?
Feb 14, 2012 12:11 PM|LINK
Hi,
http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.redirecttoaction.aspx
Thanks...
***DON'T FORGET TO CLICK “MARK AS ANSWER” ON THE POST IF HELPED YOU.
castlehills
Member
259 Points
171 Posts
Re: How do I redirect page in MVC3?
Mar 03, 2012 03:08 PM|LINK
When you use www.abc.com, the default route will run Home/Index action. To re-direct from there to index.htm, you have to use redirect to index.htm. The following code may help you:
public ActionResult Index() { ViewBag.Message = "Welcome to ASP.NET MVC!"; return Redirect("index.htm"); }