mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-21 19:34:40 +08:00
#18793: Making session utilization an opt-in/opt-out feature
Work Item: 18793 --HG-- branch : 1.x
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
Name: Themes
|
||||
AntiForgery: enabled
|
||||
SessionState: required
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.5
|
||||
|
@@ -12,16 +12,22 @@ namespace Orchard.Themes.Preview {
|
||||
|
||||
public string GetPreviewTheme() {
|
||||
var httpContext = _httpContextAccessor.Current();
|
||||
return Convert.ToString(httpContext.Session[PreviewThemeKey]);
|
||||
if (httpContext.Session != null) {
|
||||
return Convert.ToString(httpContext.Session[PreviewThemeKey]);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void SetPreviewTheme(string themeName) {
|
||||
var httpContext = _httpContextAccessor.Current();
|
||||
if (string.IsNullOrEmpty(themeName)) {
|
||||
httpContext.Session.Remove(PreviewThemeKey);
|
||||
}
|
||||
else {
|
||||
httpContext.Session[PreviewThemeKey] = themeName;
|
||||
if (httpContext.Session != null) {
|
||||
if (string.IsNullOrEmpty(themeName)) {
|
||||
httpContext.Session.Remove(PreviewThemeKey);
|
||||
}
|
||||
else {
|
||||
httpContext.Session[PreviewThemeKey] = themeName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user