From 712ad189c99570f686ab779782b2a873e172428e Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Tue, 13 Jun 2023 20:25:05 +0200 Subject: Change syntax style --- .../MatrixRoomUtils.Web.Server.csproj | 28 ++++----- MatrixRoomUtils.Web.Server/Pages/Error.cshtml | 49 ++++++++-------- MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs | 21 +++---- MatrixRoomUtils.Web.Server/Program.cs | 8 +-- .../Properties/launchSettings.json | 68 +++++++++++----------- 5 files changed, 81 insertions(+), 93 deletions(-) (limited to 'MatrixRoomUtils.Web.Server') diff --git a/MatrixRoomUtils.Web.Server/MatrixRoomUtils.Web.Server.csproj b/MatrixRoomUtils.Web.Server/MatrixRoomUtils.Web.Server.csproj index 71c3d08..a34cd2c 100644 --- a/MatrixRoomUtils.Web.Server/MatrixRoomUtils.Web.Server.csproj +++ b/MatrixRoomUtils.Web.Server/MatrixRoomUtils.Web.Server.csproj @@ -1,22 +1,22 @@ - - net7.0 - enable - enable - + + net7.0 + enable + enable + - - - + + + - - - + + + - - - + + + diff --git a/MatrixRoomUtils.Web.Server/Pages/Error.cshtml b/MatrixRoomUtils.Web.Server/Pages/Error.cshtml index 0125c85..04b2c2a 100644 --- a/MatrixRoomUtils.Web.Server/Pages/Error.cshtml +++ b/MatrixRoomUtils.Web.Server/Pages/Error.cshtml @@ -5,38 +5,37 @@ - - + + Error - - + + -
-
-

Error.

-

An error occurred while processing your request.

+
+
+

Error.

+

An error occurred while processing your request.

- @if (Model.ShowRequestId) - { -

- Request ID: @Model.RequestId -

- } - -

Development Mode

-

- Swapping to the Development environment displays detailed information about the error that occurred. -

+ @if (Model.ShowRequestId) {

- The Development environment shouldn't be enabled for deployed applications. - It can result in displaying sensitive information from exceptions to end users. - For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development - and restarting the app. + Request ID: @Model.RequestId

-
+ } + +

Development Mode

+

+ Swapping to the Development environment displays detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

+
- + \ No newline at end of file diff --git a/MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs b/MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs index b70d895..4b918c1 100644 --- a/MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs +++ b/MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs @@ -6,21 +6,14 @@ namespace MatrixRoomUtils.Web.Server.Pages; [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] [IgnoreAntiforgeryToken] -public class ErrorModel : PageModel -{ - public string? RequestId { get; set; } +public class ErrorModel : PageModel { + private readonly ILogger _logger; - public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + public ErrorModel(ILogger logger) => _logger = logger; - private readonly ILogger _logger; + public string? RequestId { get; set; } - public ErrorModel(ILogger logger) - { - _logger = logger; - } + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); - public void OnGet() - { - RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; - } -} + public void OnGet() => RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; +} \ No newline at end of file diff --git a/MatrixRoomUtils.Web.Server/Program.cs b/MatrixRoomUtils.Web.Server/Program.cs index a486226..b5c3869 100644 --- a/MatrixRoomUtils.Web.Server/Program.cs +++ b/MatrixRoomUtils.Web.Server/Program.cs @@ -9,11 +9,8 @@ var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) -{ app.UseWebAssemblyDebugging(); -} -else -{ +else { 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(); @@ -26,9 +23,8 @@ app.UseStaticFiles(); app.UseRouting(); - app.MapRazorPages(); app.MapControllers(); app.MapFallbackToFile("index.html"); -app.Run(); +app.Run(); \ No newline at end of file diff --git a/MatrixRoomUtils.Web.Server/Properties/launchSettings.json b/MatrixRoomUtils.Web.Server/Properties/launchSettings.json index 3dcf07b..ad7ef88 100644 --- a/MatrixRoomUtils.Web.Server/Properties/launchSettings.json +++ b/MatrixRoomUtils.Web.Server/Properties/launchSettings.json @@ -1,40 +1,40 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:6314", - "sslPort": 44318 + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:6314", + "sslPort": 44318 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "applicationUrl": "http://localhost:5167", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "applicationUrl": "https://localhost:7235;http://localhost:5167", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" } }, - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", - "applicationUrl": "http://localhost:5167", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", - "applicationUrl": "https://localhost:7235;http://localhost:5167", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" } } } +} -- cgit 1.5.1