From 1819f962269cd7fea0bfddce4052f9c9622bdff4 Mon Sep 17 00:00:00 2001
From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
Date: Thu, 24 Aug 2023 15:41:41 -1000
Subject: [PATCH] add snip (#177)
---
.../samples/MyAntiForgery/Program.cs | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/fundamentals/minimal-apis/samples/MyAntiForgery/Program.cs b/fundamentals/minimal-apis/samples/MyAntiForgery/Program.cs
index d6b1544..bc623bf 100644
--- a/fundamentals/minimal-apis/samples/MyAntiForgery/Program.cs
+++ b/fundamentals/minimal-apis/samples/MyAntiForgery/Program.cs
@@ -1,3 +1,6 @@
+#define SHORT // FIRST SHORT
+#if NEVER
+#elif FIRST
//
using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Mvc;
@@ -71,3 +74,20 @@ public static class MyHtml
//
}
//
+#elif SHORT
+//
+using Microsoft.AspNetCore.Antiforgery;
+
+var builder = WebApplication.CreateBuilder();
+
+builder.Services.AddAntiforgery();
+
+var app = builder.Build();
+
+// Implicitly added by WebApplicationBuilder
+// app.UseAntiforgery();
+
+app.Run();
+app.MapGet("/", () => "Hello World!");
+//
+#endif