Open bradlis7 opened 2 years ago
The best workaround I could come up with is something like this in Startup:
app.Use((context, next) => {
context.Response.OnStarting(() => {
if (context.Items.Keys.Contains("_ncache-header-reset")) {
var (cacheControl, pragma, expires) = ((StringValues, StringValues, StringValues))context.Items["_ncache-header-reset"];
context.Response.Headers["cache-control"] = cacheControl;
context.Response.Headers["pragma"] = pragma;
context.Response.Headers["expires"] = expires;
}
return System.Threading.Tasks.Task.CompletedTask;
});
return next.Invoke();
});
app.UseNCacheSession();
app.Use((context, next) => {
context.Response.OnStarting(() => {
context.Items["_ncache-header-reset"] = (context.Response.Headers["cache-control"], context.Response.Headers["pragma"], context.Response.Headers["expires"]);
return System.Threading.Tasks.Task.CompletedTask;
});
return next.Invoke();
});
@bradlis7, I have forwarded this request to our Engineering team. They will review this on their end. In the meantime, please try the workaround that you have come up with and see if this works.
Can you please provide a config so that we can turn off the manipulation of cache HTTP headers? It makes
ResponseCacheAttribute
useless.https://github.com/Alachisoft/NCache/blob/b8bb6f06372c1f79397e95b3ca8612cff24eb911/SessionState/ASP.NET%20Core/NCacheSessionServices/NCacheSessionServices/Utilities/SessionKeyManager.cs#L56