diff --git a/content/DependencyResolution/StructureMapDependencyScope.cs.pp b/content/DependencyResolution/StructureMapDependencyScope.cs.pp index a807999..c46e5cc 100644 --- a/content/DependencyResolution/StructureMapDependencyScope.cs.pp +++ b/content/DependencyResolution/StructureMapDependencyScope.cs.pp @@ -64,11 +64,13 @@ #region Properties private HttpContextBase HttpContext { - get { - var ctx = Container.TryGetInstance(); - return ctx ?? new HttpContextWrapper(System.Web.HttpContext.Current); - } - } + get { + return (System.Web.HttpContext.Current == null + ? null + : (Container.TryGetInstance() ?? + new HttpContextWrapper(System.Web.HttpContext.Current))); + } + } #endregion