diff --git a/MyWebsite/MyWebsite/Controllers/HomeController.cs b/MyWebsite/MyWebsite/Controllers/HomeController.cs index 4472646..ee883f6 100644 --- a/MyWebsite/MyWebsite/Controllers/HomeController.cs +++ b/MyWebsite/MyWebsite/Controllers/HomeController.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; +using System.Diagnostics; using Microsoft.AspNetCore.Mvc; using MyWebsite.Models; @@ -10,34 +6,11 @@ namespace MyWebsite.Controllers { public class HomeController : Controller { - public IActionResult Index() - { - return View(); - } - - public IActionResult About() - { - ViewData["Message"] = "Your application description page."; - - return View(); - } - - public IActionResult Contact() - { - ViewData["Message"] = "Your contact page."; - - return View(); - } - - public IActionResult Privacy() - { - return View(); - } + public IActionResult Index() => + View(); [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] - public IActionResult Error() - { - return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); - } + public IActionResult Error() => + View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); } } diff --git a/MyWebsite/MyWebsite/Startup.cs b/MyWebsite/MyWebsite/Startup.cs index 3d180de..1429462 100644 --- a/MyWebsite/MyWebsite/Startup.cs +++ b/MyWebsite/MyWebsite/Startup.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -38,15 +33,8 @@ namespace MyWebsite // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - else - { - app.UseExceptionHandler("/Home/Error"); - app.UseHsts(); - } + app.UseExceptionHandler("/Home/Error"); + app.UseHsts(); app.UseHttpsRedirection(); app.UseStaticFiles(); diff --git a/MyWebsite/MyWebsite/Views/Home/About.cshtml b/MyWebsite/MyWebsite/Views/Home/About.cshtml deleted file mode 100644 index 3674e37..0000000 --- a/MyWebsite/MyWebsite/Views/Home/About.cshtml +++ /dev/null @@ -1,7 +0,0 @@ -@{ - ViewData["Title"] = "About"; -} -

@ViewData["Title"]

-

@ViewData["Message"]

- -

Use this area to provide additional information.

diff --git a/MyWebsite/MyWebsite/Views/Home/Contact.cshtml b/MyWebsite/MyWebsite/Views/Home/Contact.cshtml deleted file mode 100644 index a11a186..0000000 --- a/MyWebsite/MyWebsite/Views/Home/Contact.cshtml +++ /dev/null @@ -1,17 +0,0 @@ -@{ - ViewData["Title"] = "Contact"; -} -

@ViewData["Title"]

-

@ViewData["Message"]

- -
- One Microsoft Way
- Redmond, WA 98052-6399
- P: - 425.555.0100 -
- -
- Support: Support@example.com
- Marketing: Marketing@example.com -
diff --git a/MyWebsite/MyWebsite/Views/Home/Index.cshtml b/MyWebsite/MyWebsite/Views/Home/Index.cshtml deleted file mode 100644 index f42d2a0..0000000 --- a/MyWebsite/MyWebsite/Views/Home/Index.cshtml +++ /dev/null @@ -1,94 +0,0 @@ -@{ - ViewData["Title"] = "Home Page"; -} - - - -
-
-

Application uses

- -
-
-

How to

- -
-
-

Overview

- -
-
-

Run & Deploy

- -
-
diff --git a/MyWebsite/MyWebsite/Views/Home/Privacy.cshtml b/MyWebsite/MyWebsite/Views/Home/Privacy.cshtml deleted file mode 100644 index 7bd3861..0000000 --- a/MyWebsite/MyWebsite/Views/Home/Privacy.cshtml +++ /dev/null @@ -1,6 +0,0 @@ -@{ - ViewData["Title"] = "Privacy Policy"; -} -

@ViewData["Title"]

- -

Use this page to detail your site's privacy policy.

diff --git a/MyWebsite/MyWebsite/Views/Shared/Error.cshtml b/MyWebsite/MyWebsite/Views/Shared/Error.cshtml index ec2ea6b..7ac479c 100644 --- a/MyWebsite/MyWebsite/Views/Shared/Error.cshtml +++ b/MyWebsite/MyWebsite/Views/Shared/Error.cshtml @@ -3,20 +3,25 @@ ViewData["Title"] = "Error"; } -

Error.

-

An error occurred while processing your request.

+
+

Error.

+

An error occurred while processing your request.

+
-@if (Model.ShowRequestId) -{ +
+ @if (Model.ShowRequestId) + { +

+ Request ID: @Model.RequestId +

+ } + +

Development Mode

- Request ID: @Model.RequestId + Swapping to Development environment will display more detailed information about the error that occurred.

-} +

+ Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. +

+
-

Development Mode

-

- Swapping to Development environment will display more detailed information about the error that occurred. -

-

- Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. -

diff --git a/MyWebsite/MyWebsite/Views/About/Index.cshtml b/MyWebsite/MyWebsite/Views/Shared/Index.cshtml similarity index 100% rename from MyWebsite/MyWebsite/Views/About/Index.cshtml rename to MyWebsite/MyWebsite/Views/Shared/Index.cshtml diff --git a/MyWebsite/MyWebsite/Views/Shared/_CookieConsentPartial.cshtml b/MyWebsite/MyWebsite/Views/Shared/_CookieConsentPartial.cshtml deleted file mode 100644 index bbfbb09..0000000 --- a/MyWebsite/MyWebsite/Views/Shared/_CookieConsentPartial.cshtml +++ /dev/null @@ -1,41 +0,0 @@ -@using Microsoft.AspNetCore.Http.Features - -@{ - var consentFeature = Context.Features.Get(); - var showBanner = !consentFeature?.CanTrack ?? false; - var cookieString = consentFeature?.CreateConsentCookie(); -} - -@if (showBanner) -{ - - -} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Views/Shared/_ValidationScriptsPartial.cshtml b/MyWebsite/MyWebsite/Views/Shared/_ValidationScriptsPartial.cshtml deleted file mode 100644 index 2a9241f..0000000 --- a/MyWebsite/MyWebsite/Views/Shared/_ValidationScriptsPartial.cshtml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - -