From d58c49b1d5fcde2c3bde736294cbfed5db85e2b6 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Thu, 7 Dec 2017 11:11:27 -0500 Subject: [PATCH] add 404 --- .vscode/launch.json | 9 ++++++--- .vscode/tasks.json | 11 +++++------ Startup.cs | 6 +++++- aka.terribledev.io.sln | 36 ++++++++++++++++++++++++------------ 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1d84086..1c8e748 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,4 +1,7 @@ { + // 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": [ { @@ -6,9 +9,9 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceRoot}\\bin\\Debug\\netcoreapp1.1\\aka.terribledev.io.dll", + "program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/aka.terribledev.io.dll", "args": [], - "cwd": "${workspaceRoot}", + "cwd": "${workspaceFolder}", "stopAtEntry": false, "internalConsoleOptions": "openOnSessionStart", "launchBrowser": { @@ -29,7 +32,7 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "sourceFileMap": { - "/Views": "${workspaceRoot}/Views" + "/Views": "${workspaceFolder}/Views" } }, { diff --git a/.vscode/tasks.json b/.vscode/tasks.json index eae0a35..e4bcfc9 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,15 +1,14 @@ { - "version": "0.1.0", - "command": "dotnet", - "isShellCommand": true, - "args": [], + "version": "2.0.0", "tasks": [ { "taskName": "build", + "command": "dotnet", + "type": "process", "args": [ - "${workspaceRoot}\\aka.terribledev.io.csproj" + "build", + "${workspaceFolder}/aka.terribledev.io.csproj" ], - "isBuildCommand": true, "problemMatcher": "$msCompile" } ] diff --git a/Startup.cs b/Startup.cs index eea3d6d..23d3f6a 100644 --- a/Startup.cs +++ b/Startup.cs @@ -14,6 +14,7 @@ namespace aka.terribledev.io public class Startup { public static byte[] hello = System.Text.Encoding.UTF8.GetBytes("hello"); + public static byte[] fourOhFor = System.Text.Encoding.UTF8.GetBytes("404"); public static int helloCount = hello.Count(); public Startup(IHostingEnvironment env) { @@ -72,7 +73,10 @@ namespace aka.terribledev.io await b.Response.Body.WriteAsync(Startup.hello, 0, helloCount); }); }); - + app.Use(async (context, next)=>{ + context.Response.StatusCode = 404; + await context.Response.Body.WriteAsync(fourOhFor, 0, fourOhFor.Count()); + }); } } diff --git a/aka.terribledev.io.sln b/aka.terribledev.io.sln index 899888c..5887294 100644 --- a/aka.terribledev.io.sln +++ b/aka.terribledev.io.sln @@ -1,22 +1,34 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26430.6 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "aka.terribledev.io", "aka.terribledev.io.csproj", "{2083DD24-BF66-4D77-B453-BB86AE273766}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "aka.terribledev.io", "aka.terribledev.io.csproj", "{6F53DA0D-3316-452B-AF94-6CC951480E4F}" EndProject Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2083DD24-BF66-4D77-B453-BB86AE273766}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2083DD24-BF66-4D77-B453-BB86AE273766}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2083DD24-BF66-4D77-B453-BB86AE273766}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2083DD24-BF66-4D77-B453-BB86AE273766}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6F53DA0D-3316-452B-AF94-6CC951480E4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6F53DA0D-3316-452B-AF94-6CC951480E4F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6F53DA0D-3316-452B-AF94-6CC951480E4F}.Debug|x64.ActiveCfg = Debug|x64 + {6F53DA0D-3316-452B-AF94-6CC951480E4F}.Debug|x64.Build.0 = Debug|x64 + {6F53DA0D-3316-452B-AF94-6CC951480E4F}.Debug|x86.ActiveCfg = Debug|x86 + {6F53DA0D-3316-452B-AF94-6CC951480E4F}.Debug|x86.Build.0 = Debug|x86 + {6F53DA0D-3316-452B-AF94-6CC951480E4F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6F53DA0D-3316-452B-AF94-6CC951480E4F}.Release|Any CPU.Build.0 = Release|Any CPU + {6F53DA0D-3316-452B-AF94-6CC951480E4F}.Release|x64.ActiveCfg = Release|x64 + {6F53DA0D-3316-452B-AF94-6CC951480E4F}.Release|x64.Build.0 = Release|x64 + {6F53DA0D-3316-452B-AF94-6CC951480E4F}.Release|x86.ActiveCfg = Release|x86 + {6F53DA0D-3316-452B-AF94-6CC951480E4F}.Release|x86.Build.0 = Release|x86 + EndGlobalSection EndGlobal