diff --git a/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs b/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs index b7dd2f04529..ac542d28335 100644 --- a/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs +++ b/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs @@ -223,7 +223,7 @@ private static string GetPortalSettingThroughReflection(string settingKey) try { var method = _portalAliasControllerType.GetMethod("GetPortalAliasInfo"); - var portalAliasInfo = method.Invoke(null, new object[] { HttpContext.Current.Request.Url.Host }); + var portalAliasInfo = HttpContext.Current != null ? method.Invoke(null, new object[] { HttpContext.Current.Request.Url.Host }) : null; if (portalAliasInfo != null) { object portalId = portalAliasInfo.GetType().GetProperty("PortalID").GetValue(portalAliasInfo, new object[] { });