I have set default routing in razor this my code. But it's not working
- services.AddMvc().AddRazorPagesOptions(options =>
- {
- options.Conventions.AddPageRoute("/PageTemplates/_Home", "");
- });
- }
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
- {
- if (!env.IsDevelopment())
- {
- app.UseHsts();
- }
- app.UseHttpsRedirection();
- app.UseCofoundry();
- app.UseRouting();
- app.UseEndpoints(endpoints =>
- {
- endpoints.MapRazorPages();
- });
By default Error.cshtml page run i want to run home page .Please help me
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Sachin SinghRank #66 · 26.2K reputationPosted Mar 2, 2021, 5:29 AM EST
Kiran MohantyRank #821 · 2.8K reputationPosted Mar 2, 2021, 6:14 AM EST
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 2, 2021, 6:40 AM EST