diff --git a/fundamentals/environments/3.0/EnvironmentsSample/.vscode/launch.json b/fundamentals/environments/3.0/EnvironmentsSample/.vscode/launch.json
new file mode 100644
index 0000000..457e347
--- /dev/null
+++ b/fundamentals/environments/3.0/EnvironmentsSample/.vscode/launch.json
@@ -0,0 +1,50 @@
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": ".NET Core Launch (web)",
+ "type": "coreclr",
+ // Configuration ommitted for brevity.
+ "request": "launch",
+ "preLaunchTask": "build",
+ "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/EnvironmentsSample.dll",
+ "args": [],
+ "cwd": "${workspaceFolder}",
+ "stopAtEntry": false,
+ "internalConsoleOptions": "openOnSessionStart",
+ "launchBrowser": {
+ "enabled": true,
+ "args": "${auto-detect-url}",
+ "windows": {
+ "command": "cmd.exe",
+ "args": "/C start ${auto-detect-url}"
+ },
+ "osx": {
+ "command": "open"
+ },
+ "linux": {
+ "command": "xdg-open"
+ }
+ },
+ "env": {
+ "ASPNETCORE_ENVIRONMENT": "Development",
+ "ASPNETCORE_URLS": "https://localhost:5001",
+ "ASPNETCORE_DETAILEDERRORS": "1",
+ "ASPNETCORE_SHUTDOWNTIMEOUTSECONDS": "3"
+ },
+ // Configuration ommitted for brevity.
+ "sourceFileMap": {
+ "/Views": "${workspaceFolder}/Views"
+ }
+ },
+ {
+ "name": ".NET Core Attach",
+ "type": "coreclr",
+ "request": "attach",
+ "processId": "${command:pickProcess}"
+ }
+ ]
+}
diff --git a/fundamentals/environments/3.0/EnvironmentsSample/EnvironmentsSample.csproj b/fundamentals/environments/3.0/EnvironmentsSample/EnvironmentsSample.csproj
new file mode 100644
index 0000000..d6c95e8
--- /dev/null
+++ b/fundamentals/environments/3.0/EnvironmentsSample/EnvironmentsSample.csproj
@@ -0,0 +1,14 @@
+
ASPNETCORE_ENVIRONMENT = @hostingEnv.EnvironmentName
+ + +
+ Request ID: @Model.RequestId
+
+ 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. +
diff --git a/fundamentals/environments/3.0/EnvironmentsSample/Pages/Error.cshtml.cs b/fundamentals/environments/3.0/EnvironmentsSample/Pages/Error.cshtml.cs new file mode 100644 index 0000000..95b7a53 --- /dev/null +++ b/fundamentals/environments/3.0/EnvironmentsSample/Pages/Error.cshtml.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.Logging; + +namespace EnvironmentsSample.Pages +{ + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public class ErrorModel : PageModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + + private readonly ILoggerLearn about building Web apps with ASP.NET Core.
+Use this page to detail your site's privacy policy.
diff --git a/fundamentals/environments/3.0/EnvironmentsSample/Pages/Privacy.cshtml.cs b/fundamentals/environments/3.0/EnvironmentsSample/Pages/Privacy.cshtml.cs new file mode 100644 index 0000000..0784bea --- /dev/null +++ b/fundamentals/environments/3.0/EnvironmentsSample/Pages/Privacy.cshtml.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.Logging; + +namespace EnvironmentsSample.Pages +{ + public class PrivacyModel : PageModel + { + private readonly ILogger