Reputation: 9304
I have an ASP.Net MVC/Razor app. The default view is always assumed to be Index.html, and I would like to know where that is set and whether that can be changed. I do not like having dozens of files all named Index.cshtml, and would prefer my default files to be named something else.
Is is possible to change this default? I know that I can just set a different view path when Index is called in the controller, but would like something less manual.
Upvotes: 0
Views: 846
Reputation: 36575
Just change your route template:
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=OtherPage}/{id?}");
});
Upvotes: 1