From d08754f8f6293154a34160185d624cdcd39d8ca0 Mon Sep 17 00:00:00 2001 From: dev01 Date: Fri, 8 Sep 2023 21:24:43 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=AD=A6=E6=80=A5=E6=87=89=E8=AE=8A]=20?= =?UTF-8?q?=E8=AD=A6=E6=88=92=E5=80=BC=E8=A8=AD=E5=AE=9A=20Model=20?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E8=AA=BF=E6=95=B4=20|=20X=20Frame=20Option?= =?UTF-8?q?=20=E6=94=B9=20SAMEORGIN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontendWebApi/Startup.cs | 4 ++++ FrontendWebApi/Views/Shared/_Layout.cshtml | 18 +++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/FrontendWebApi/Startup.cs b/FrontendWebApi/Startup.cs index 627983f..79d0ded 100644 --- a/FrontendWebApi/Startup.cs +++ b/FrontendWebApi/Startup.cs @@ -170,7 +170,11 @@ namespace FrontendWebApi app.UseAuthentication(); app.UseAuthorization(); + app.Use(async (context, next) => + { context.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN"); + await next(); + }); //app.UseEndpoints(endpoints => //{ diff --git a/FrontendWebApi/Views/Shared/_Layout.cshtml b/FrontendWebApi/Views/Shared/_Layout.cshtml index ea4b6d5..9765833 100644 --- a/FrontendWebApi/Views/Shared/_Layout.cshtml +++ b/FrontendWebApi/Views/Shared/_Layout.cshtml @@ -843,8 +843,8 @@