diff --git a/src/Infrastructure/BotSharp.Abstraction/Infrastructures/SharpCacheAttribute.cs b/src/Infrastructure/BotSharp.Abstraction/Infrastructures/SharpCacheAttribute.cs index c8b29ecd..c8f6a674 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Infrastructures/SharpCacheAttribute.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Infrastructures/SharpCacheAttribute.cs @@ -50,7 +50,9 @@ public class SharpCacheAttribute : MoAttribute } var httpContext = Services.GetRequiredService(); - if (httpContext.HttpContext.Response.Headers["Cache-Control"].ToString().Contains("no-store")) + if (httpContext != null && + httpContext.HttpContext != null && + httpContext.HttpContext.Response.Headers["Cache-Control"].ToString().Contains("no-store")) { return; }