Guest User

Guest User

  • Tech Writer
  • 611
  • 70.8k

Routing in .net core.

Mar 2 2021 10:17 AM
I have set default routing in razor this my code. But it's not working
  1. services.AddMvc().AddRazorPagesOptions(options =>  
  2. {  
  3. options.Conventions.AddPageRoute("/PageTemplates/_Home""");  
  4. });  
  5. }  
  6. public void Configure(IApplicationBuilder app, IWebHostEnvironment env)  
  7. {  
  8. if (!env.IsDevelopment())  
  9. {  
  10. app.UseHsts();  
  11. }  
  12. app.UseHttpsRedirection();  
  13. app.UseCofoundry();  
  14. app.UseRouting();  
  15. app.UseEndpoints(endpoints =>  
  16. {  
  17. endpoints.MapRazorPages();  
  18. });  
By default Error.cshtml page run i want to run home page .Please help me

Answers (3)