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.
Just change your route template:
app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=OtherPage}/{id?}"); });
2.1m questions
2.1m answers
60 comments
57.0k users