Make 500 Error page

This commit is contained in:
Дмитрий Шиманский
2023-10-22 17:02:30 +03:00
parent 76208767b2
commit 35368f4d7c
8 changed files with 758 additions and 21 deletions

View File

@@ -18,7 +18,8 @@ namespace yaflay.ru
.AddRazorPagesOptions(options =>
{
options.Conventions.AddPageRoute("/RobotsTxt", "/Robots.txt");
options.Conventions.AddPageRoute("/ErrorPage", "/404");
options.Conventions.AddPageRoute("/NotFound", "/404");
options.Conventions.AddPageRoute("/IternalErrorPage", "/500");
});
services.AddRouting();
services.AddRazorPages();
@@ -26,7 +27,8 @@ namespace yaflay.ru
.AddRazorPagesOptions(options =>
{
options.Conventions.AddPageRoute("/RobotsTxt", "/Robots.txt");
options.Conventions.AddPageRoute("/ErrorPage", "/404");
options.Conventions.AddPageRoute("/NotFound", "/404");
options.Conventions.AddPageRoute("/IternalErrorPage", "/500");
});
//services.AddDirectoryBrowser();
@@ -38,15 +40,18 @@ namespace yaflay.ru
{
// Add services to the container.
// app.Services.AddRazorPages();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
//app.UseHsts();
}
// Configure the HTTP request pipeline.
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();