custom error pages
This commit is contained in:
		
							parent
							
								
									1bb0e53928
								
							
						
					
					
						commit
						a779eafff5
					
				
							
								
								
									
										32
									
								
								EnotaryoPH/EnotaryoPH.Web/Pages/404.cshtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								EnotaryoPH/EnotaryoPH.Web/Pages/404.cshtml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | |||||||
|  | @page | ||||||
|  | @{ | ||||||
|  |     Layout = "_Blank"; | ||||||
|  | } | ||||||
|  | <body> | ||||||
|  |     <header></header> | ||||||
|  |     <div class="container" style="max-width: 1000px;font-weight: bold;"> | ||||||
|  |         <nav class="navbar navbar-expand-md bg-body py-3"> | ||||||
|  |             <div class="container"> | ||||||
|  |                 <a class="navbar-brand d-flex align-items-center" href="/"> | ||||||
|  |                     <span class="bs-icon-sm bs-icon-rounded d-flex justify-content-center align-items-center bs-icon" style="border-radius: 0px;"> | ||||||
|  |                         <svg class="bi bi-pen-fill" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 16 16"> | ||||||
|  |                             <path d="m13.498.795.149-.149a1.207 1.207 0 1 1 1.707 1.708l-.149.148a1.5 1.5 0 0 1-.059 2.059L4.854 14.854a.5.5 0 0 1-.233.131l-4 1a.5.5 0 0 1-.606-.606l1-4a.5.5 0 0 1 .131-.232l9.642-9.642a.5.5 0 0 0-.642.056L6.854 4.854a.5.5 0 1 1-.708-.708L9.44.854A1.5 1.5 0 0 1 11.5.796a1.5 1.5 0 0 1 1.998-.001"></path> | ||||||
|  |                         </svg> | ||||||
|  |                     </span><span>eNotaryo PH</span> | ||||||
|  |                 </a> | ||||||
|  |             </div> | ||||||
|  |         </nav> | ||||||
|  |         <div class="text-center"> | ||||||
|  |             <div class="row text-center pt-4"> | ||||||
|  |                 <div class="col col-12 col-lg-10 mx-auto"> | ||||||
|  |                     <div class="text-center position-relative"><img class="img-fluid" src="images/404.jpg" /></div> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |     </div> | ||||||
|  |     <footer class="mt-5"> | ||||||
|  |         <div class="container" style="max-width: 1000px;"> | ||||||
|  |             <p class="text-center text-md-start">Copyright <span style="color: rgba(18, 22, 67, 0.75);">©</span> 2025 eNotaryoPH</p> | ||||||
|  |         </div> | ||||||
|  |     </footer> | ||||||
|  | </body> | ||||||
							
								
								
									
										32
									
								
								EnotaryoPH/EnotaryoPH.Web/Pages/500.cshtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								EnotaryoPH/EnotaryoPH.Web/Pages/500.cshtml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | |||||||
|  | @page | ||||||
|  | @{ | ||||||
|  |     Layout = "_Blank"; | ||||||
|  | } | ||||||
|  | <body> | ||||||
|  |     <header></header> | ||||||
|  |     <div class="container" style="max-width: 1000px;font-weight: bold;"> | ||||||
|  |         <nav class="navbar navbar-expand-md bg-body py-3"> | ||||||
|  |             <div class="container"> | ||||||
|  |                 <a class="navbar-brand d-flex align-items-center" href="/"> | ||||||
|  |                     <span class="bs-icon-sm bs-icon-rounded d-flex justify-content-center align-items-center bs-icon" style="border-radius: 0px;"> | ||||||
|  |                         <svg class="bi bi-pen-fill" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 16 16"> | ||||||
|  |                             <path d="m13.498.795.149-.149a1.207 1.207 0 1 1 1.707 1.708l-.149.148a1.5 1.5 0 0 1-.059 2.059L4.854 14.854a.5.5 0 0 1-.233.131l-4 1a.5.5 0 0 1-.606-.606l1-4a.5.5 0 0 1 .131-.232l9.642-9.642a.5.5 0 0 0-.642.056L6.854 4.854a.5.5 0 1 1-.708-.708L9.44.854A1.5 1.5 0 0 1 11.5.796a1.5 1.5 0 0 1 1.998-.001"></path> | ||||||
|  |                         </svg> | ||||||
|  |                     </span><span>eNotaryo PH</span> | ||||||
|  |                 </a><button class="navbar-toggler" data-bs-toggle="collapse"><span class="visually-hidden">Toggle navigation</span><span class="navbar-toggler-icon"></span></button> | ||||||
|  |             </div> | ||||||
|  |         </nav> | ||||||
|  |         <div class="text-center"> | ||||||
|  |             <div class="row text-center pt-4"> | ||||||
|  |                 <div class="col col-12 col-lg-10 mx-auto"> | ||||||
|  |                     <div class="text-center position-relative"><img class="img-fluid" src="images/500.jpg" /></div> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |     </div> | ||||||
|  |     <footer class="mt-5"> | ||||||
|  |         <div class="container" style="max-width: 1000px;"> | ||||||
|  |             <p class="text-center text-md-start">Copyright <span style="color: rgba(18, 22, 67, 0.75);">©</span> 2025 eNotaryoPH</p> | ||||||
|  |         </div> | ||||||
|  |     </footer> | ||||||
|  | </body> | ||||||
| @ -1,4 +1,4 @@ | |||||||
| @page | @page "{statusCode}" | ||||||
| @model ErrorModel | @model ErrorModel | ||||||
| @{ | @{ | ||||||
|     ViewData["Title"] = "Error"; |     ViewData["Title"] = "Error"; | ||||||
|  | |||||||
| @ -8,21 +8,31 @@ namespace EnotaryoPH.Web.Pages | |||||||
|     [IgnoreAntiforgeryToken] |     [IgnoreAntiforgeryToken] | ||||||
|     public class ErrorModel : PageModel |     public class ErrorModel : PageModel | ||||||
|     { |     { | ||||||
|  |         private readonly ILogger<ErrorModel> _logger; | ||||||
|  | 
 | ||||||
|  |         public ErrorModel(ILogger<ErrorModel> logger) => _logger = logger; | ||||||
|  | 
 | ||||||
|  |         public IActionResult OnGet() | ||||||
|  |         { | ||||||
|  |             RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; | ||||||
|  | 
 | ||||||
|  |             if (StatusCode == "404") | ||||||
|  |             { | ||||||
|  |                 return Redirect("/404"); | ||||||
|  |             } | ||||||
|  |             else if (StatusCode == "500") | ||||||
|  |             { | ||||||
|  |                 return Redirect("/500"); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             return Page(); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         public string? RequestId { get; set; } |         public string? RequestId { get; set; } | ||||||
| 
 | 
 | ||||||
|         public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); |         public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); | ||||||
| 
 | 
 | ||||||
|         private readonly ILogger<ErrorModel> _logger; |         [FromRoute] | ||||||
| 
 |         public string StatusCode { get; set; } | ||||||
|         public ErrorModel(ILogger<ErrorModel> logger) |  | ||||||
|         { |  | ||||||
|             _logger = logger; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public void OnGet() |  | ||||||
|         { |  | ||||||
|             RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -105,12 +105,18 @@ namespace EnotaryoPH.Web | |||||||
|                 .Schedule<CheckRecordingAvailabilityInvocable>() |                 .Schedule<CheckRecordingAvailabilityInvocable>() | ||||||
|                 .EveryTenSeconds()); |                 .EveryTenSeconds()); | ||||||
| 
 | 
 | ||||||
|             // Configure the HTTP request pipeline. |             if (app.Environment.IsDevelopment()) | ||||||
|             if (!app.Environment.IsDevelopment()) |  | ||||||
|             { |             { | ||||||
|  |                 app.UseDeveloperExceptionPage(); | ||||||
|  |             } | ||||||
|  |             else | ||||||
|  |             { | ||||||
|  |                 // UseExceptionHandler for general error handling | ||||||
|                 app.UseExceptionHandler("/Error"); |                 app.UseExceptionHandler("/Error"); | ||||||
|                 // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | 
 | ||||||
|                 app.UseHsts(); |                 app.UseStatusCodePagesWithReExecute("/Error/{0}"); // Redirect to the Error page with status code | ||||||
|  | 
 | ||||||
|  |                 app.UseHsts(); // Only in production | ||||||
|             } |             } | ||||||
|             app.UseSession(); |             app.UseSession(); | ||||||
|             app.Use(async (context, next) => |             app.Use(async (context, next) => | ||||||
|  | |||||||
							
								
								
									
										
											BIN
										
									
								
								EnotaryoPH/EnotaryoPH.Web/wwwroot/images/404.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EnotaryoPH/EnotaryoPH.Web/wwwroot/images/404.jpg
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 208 KiB | 
							
								
								
									
										
											BIN
										
									
								
								EnotaryoPH/EnotaryoPH.Web/wwwroot/images/500.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EnotaryoPH/EnotaryoPH.Web/wwwroot/images/500.jpg
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 448 KiB | 
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user