-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Rollout] Production rollout 2025-01-02 part 2 (#4292)
- Loading branch information
Showing
3 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/ProductConstructionService/ProductConstructionService.Api/Pages/Error.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@page | ||
@model ProductConstructionService.Api.Pages.ErrorModel | ||
@using System.Net | ||
@using Microsoft.AspNetCore.Http | ||
@{ | ||
ViewBag.Title = "Error"; | ||
} | ||
|
||
@if (Model.StatusCode == StatusCodes.Status401Unauthorized) | ||
{ | ||
<div> | ||
Please <a href="/Account/SignIn?returnUrl=@WebUtility.UrlEncode(Model.ReturnUrl)">Sign In</a> to use this site. Make sure you have joined the | ||
<a href="https://coreidentity.microsoft.com/manage/Entitlement/entitlement/dotnetesmaes-z54r" target="_blank">dotnetes-maestro-users group</a>. | ||
</div> | ||
} | ||
else | ||
{ | ||
<div class="alert alert-danger"> | ||
<strong>@Model.StatusCode</strong> @Model.ErrorMessage | ||
</div> | ||
} |
26 changes: 26 additions & 0 deletions
26
src/ProductConstructionService/ProductConstructionService.Api/Pages/Error.cshtml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.AspNetCore.Diagnostics; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
||
namespace ProductConstructionService.Api.Pages; | ||
|
||
public class ErrorModel : PageModel | ||
{ | ||
public new int StatusCode { get; set; } | ||
|
||
public string? ErrorMessage { get; set; } | ||
|
||
public string? ReturnUrl => HttpContext.Features.Get<IStatusCodeReExecuteFeature>()?.OriginalPath; | ||
|
||
public void OnGet(int code) | ||
{ | ||
StatusCode = code; | ||
ErrorMessage = HttpContext.Items["ErrorMessage"]?.ToString(); | ||
if (string.IsNullOrEmpty(ErrorMessage)) | ||
{ | ||
ErrorMessage = "Unable to process request."; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters