I am trying to find a better way for the landing page and I would like my URL to be like this.
- www.myweb.com <=== Landing Page
- www.myweb.com/Home <=== Home
Then I came up with this.
routes.MapRoute(
"Landing",
"",
new { controller = "Home", action = "Landing" }
);
routes.MapRoute(
"Home",
"Home",
new { controller = "Home", action = "Index" }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
The first one is ( Landing) to redirect www.myweb.com to View/Home/Landing.cshtml. The second ( Home) is mke www.myweb.com/Home redirect to View/Home/Index.cshtml.
I would like to ask if there are any better ways than this? or is it just great? Thanks for the tips .
source
share