mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-11-24 16:53:10 +08:00
Fixes disposed LifetimeScope issue (#8490)
* fixed scope in in recomputing the context to figure out whether an antiforgery token needs replacing
This commit is contained in:
committed by
GitHub
parent
b37256fc94
commit
074a0b140d
@@ -236,10 +236,11 @@ namespace Orchard.OutputCache.Filters {
|
|||||||
Logger.Debug("Response for item '{0}' will not be cached because status code was set to {1} during rendering.", _cacheKey, response.StatusCode);
|
Logger.Debug("Response for item '{0}' will not be cached because status code was set to {1} during rendering.", _cacheKey, response.StatusCode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cachedOutput = ReplaceRequestVerificationTokenWithBeaconTag(output, response.ContentEncoding);
|
|
||||||
|
|
||||||
using (var scope = _workContextAccessor.CreateWorkContextScope()) {
|
using (var scope = _workContextAccessor.CreateWorkContextScope()) {
|
||||||
|
// ask for the WorkContext again so it refreshes in case the scope has been disposed
|
||||||
|
_workContext = _workContextAccessor.GetContext(filterContext.HttpContext);
|
||||||
|
var cachedOutput = ReplaceRequestVerificationTokenWithBeaconTag(output, response.ContentEncoding);
|
||||||
|
|
||||||
var cacheItem = new CacheItem() {
|
var cacheItem = new CacheItem() {
|
||||||
CachedOnUtc = _now,
|
CachedOnUtc = _now,
|
||||||
Duration = cacheDuration,
|
Duration = cacheDuration,
|
||||||
@@ -648,7 +649,9 @@ namespace Orchard.OutputCache.Filters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private bool PreventCachingRequestVerificationToken() {
|
private bool PreventCachingRequestVerificationToken() {
|
||||||
return _cacheSettings.CacheAuthenticatedRequests && (!_cacheSettings.VaryByAuthenticationState || _workContext.CurrentUser != null);
|
return _cacheSettings.CacheAuthenticatedRequests
|
||||||
|
&& (!_cacheSettings.VaryByAuthenticationState
|
||||||
|
|| _workContext.CurrentUser != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool IsIgnoredUrl(string url) {
|
protected virtual bool IsIgnoredUrl(string url) {
|
||||||
|
|||||||
Reference in New Issue
Block a user