I need to show my View on the main page. Suppose that I have an application called "Sample". When a user comes to sample.com it will go to the sample.com/Home/Index. Is there any way/method to show the view in sample.com itself as we do in pure HTML Pages? Even though I've done several google-search I ended up in misleading content.
You have to set RouteConfig:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
Result:
http://localhost:51225/Home/Index/1 => Index.html
http://localhost:51225/Home/Index/ => Index.html
http://localhost:51225/Home/ => Index.html
http://localhost:51225/ => Index.html
http://sample.com/Home/Index/1 => Index.html
http://sample.com/Home/Index/ => Index.html
http://sample.com/Home/ => Index.html
http://sample.com/ => Index.html
You can learn more at: https://www.tutorialsteacher.com/mvc/routing-in-mvc