diff --git a/Infrastructure/Controllers/BaseController.cs b/Infrastructure/Controllers/BaseController.cs index 9ef8573f..eb8af6d6 100644 --- a/Infrastructure/Controllers/BaseController.cs +++ b/Infrastructure/Controllers/BaseController.cs @@ -1,6 +1,7 @@ using Infrastructure.Extensions; using Infrastructure.Model; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using MiniExcelLibs; using Newtonsoft.Json; @@ -71,7 +72,7 @@ protected IActionResult ExportExcel(string path, string fileName) } var stream = System.IO.File.OpenRead(path); //创建文件流 - Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition"); + Response.Headers.Append("Access-Control-Expose-Headers", "Content-Disposition"); return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", HttpUtility.UrlEncode(fileName)); } @@ -88,7 +89,7 @@ protected IActionResult DownFile(string path, string fileName) return NotFound(); } var stream = System.IO.File.OpenRead(path); //创建文件流 - Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition"); + Response.Headers.Append("Access-Control-Expose-Headers", "Content-Disposition"); return File(stream, "application/octet-stream", HttpUtility.UrlEncode(fileName)); } diff --git a/Infrastructure/Controllers/JsonApiController.cs b/Infrastructure/Controllers/JsonApiController.cs index ca8453ef..bbc2466d 100644 --- a/Infrastructure/Controllers/JsonApiController.cs +++ b/Infrastructure/Controllers/JsonApiController.cs @@ -1,6 +1,7 @@ using Infrastructure.Extensions; using Infrastructure.Model; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using MiniExcelLibs; using System; @@ -75,7 +76,7 @@ protected IActionResult ExportExcel(string path, string fileName) } var stream = System.IO.File.OpenRead(path); //创建文件流 - Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition"); + Response.Headers.Append("Access-Control-Expose-Headers", "Content-Disposition"); return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", HttpUtility.UrlEncode(fileName)); } @@ -92,7 +93,7 @@ protected IActionResult DownFile(string path, string fileName) return NotFound(); } var stream = System.IO.File.OpenRead(path); //创建文件流 - Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition"); + Response.Headers.Append("Access-Control-Expose-Headers", "Content-Disposition"); return File(stream, "application/octet-stream", HttpUtility.UrlEncode(fileName)); } diff --git a/Infrastructure/WebExtensions/JwtExtension.cs b/Infrastructure/WebExtensions/JwtExtension.cs index bd30ca1f..1dab3a34 100644 --- a/Infrastructure/WebExtensions/JwtExtension.cs +++ b/Infrastructure/WebExtensions/JwtExtension.cs @@ -1,5 +1,6 @@ using Infrastructure; using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.IdentityModel.Tokens; using System; @@ -27,7 +28,7 @@ public static void AddJwt(this IServiceCollection services) if (context.Exception.GetType() == typeof(SecurityTokenExpiredException)) { Console.WriteLine("jwt过期了"); - context.Response.Headers.Add("Token-Expired", "true"); + context.Response.Headers.Append("Token-Expired", "true"); } return Task.CompletedTask; diff --git a/Infrastructure/ZR.Infrastructure.csproj b/Infrastructure/ZR.Infrastructure.csproj index c81c7a23..38a96f4a 100644 --- a/Infrastructure/ZR.Infrastructure.csproj +++ b/Infrastructure/ZR.Infrastructure.csproj @@ -1,6 +1,6 @@  - net7.0 + net8.0 8632 @@ -12,12 +12,14 @@ - + + + - + - + diff --git a/ZR.Admin.WebApi/Program.cs b/ZR.Admin.WebApi/Program.cs index 3e5d07a6..c4886088 100644 --- a/ZR.Admin.WebApi/Program.cs +++ b/ZR.Admin.WebApi/Program.cs @@ -111,7 +111,7 @@ context.Request.EnableBuffering(); if (context.Request.Query.TryGetValue("access_token", out var token)) { - context.Request.Headers.Add("Authorization", $"Bearer {token}"); + context.Request.Headers.Append("Authorization", $"Bearer {token}"); } return next(); }); diff --git a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj index 263e95be..2bc3efb4 100644 --- a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj +++ b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj @@ -1,6 +1,6 @@  - net7.0 + net8.0 enable enable true @@ -17,13 +17,19 @@ - - - - - + + + + + + + + + + + diff --git a/ZR.CodeGenerator/ZR.CodeGenerator.csproj b/ZR.CodeGenerator/ZR.CodeGenerator.csproj index 6db23131..5271e32b 100644 --- a/ZR.CodeGenerator/ZR.CodeGenerator.csproj +++ b/ZR.CodeGenerator/ZR.CodeGenerator.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 @@ -11,7 +11,11 @@ + - + + + + diff --git a/ZR.Common/ZR.Common.csproj b/ZR.Common/ZR.Common.csproj index 91bebd6c..90354978 100644 --- a/ZR.Common/ZR.Common.csproj +++ b/ZR.Common/ZR.Common.csproj @@ -1,13 +1,17 @@  - net7.0 + net8.0 - - - + + + + + + + diff --git a/ZR.Model/ZR.Model.csproj b/ZR.Model/ZR.Model.csproj index 2e997ca1..7bb0d508 100644 --- a/ZR.Model/ZR.Model.csproj +++ b/ZR.Model/ZR.Model.csproj @@ -1,15 +1,16 @@  - net7.0 + net8.0 true 1701;1702;1591;1570 - + - + + diff --git a/ZR.Repository/ZR.Repository.csproj b/ZR.Repository/ZR.Repository.csproj index d3eb0207..6a8158bb 100644 --- a/ZR.Repository/ZR.Repository.csproj +++ b/ZR.Repository/ZR.Repository.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 @@ -13,6 +13,7 @@ - + + diff --git a/ZR.Service/ZR.Service.csproj b/ZR.Service/ZR.Service.csproj index bbb3ce18..55a4b885 100644 --- a/ZR.Service/ZR.Service.csproj +++ b/ZR.Service/ZR.Service.csproj @@ -1,13 +1,20 @@  - net7.0 + net8.0 enable true 1591 + + + + + + + diff --git a/ZR.ServiceCore/Filters/VerifyAttribute.cs b/ZR.ServiceCore/Filters/VerifyAttribute.cs index dfc69d4e..24c1a18e 100644 --- a/ZR.ServiceCore/Filters/VerifyAttribute.cs +++ b/ZR.ServiceCore/Filters/VerifyAttribute.cs @@ -1,6 +1,7 @@ using Infrastructure; using Infrastructure.Model; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Filters; @@ -55,10 +56,10 @@ public void OnAuthorization(AuthorizationFilterContext context) //移动端不加下面这个获取不到自定义Header if (osType != null) { - context.HttpContext.Response.Headers.Add("Access-Control-Expose-Headers", "X-Refresh-Token"); + context.HttpContext.Response.Headers.Append("Access-Control-Expose-Headers", "X-Refresh-Token"); } logger.Info($"刷新token,userName={loginUser.UserName},token={newToken}"); - context.HttpContext.Response.Headers.Add("X-Refresh-Token", newToken); + context.HttpContext.Response.Headers.Append("X-Refresh-Token", newToken); } } if (loginUser == null || !isAuthed) diff --git a/ZR.ServiceCore/ZR.ServiceCore.csproj b/ZR.ServiceCore/ZR.ServiceCore.csproj index 59a768ef..63e7e329 100644 --- a/ZR.ServiceCore/ZR.ServiceCore.csproj +++ b/ZR.ServiceCore/ZR.ServiceCore.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable true 1701;1702;1591;1570 @@ -13,8 +13,13 @@ + + - + + + + diff --git a/ZR.Tasks/ZR.Tasks.csproj b/ZR.Tasks/ZR.Tasks.csproj index 626c7720..a0ff62c7 100644 --- a/ZR.Tasks/ZR.Tasks.csproj +++ b/ZR.Tasks/ZR.Tasks.csproj @@ -1,13 +1,18 @@  - net7.0 + net8.0 - - - + + + + + + + +