diff --git a/src/React.Web/AspNetCache.cs b/src/React.Web/AspNetCache.cs index 8d07da7d6..4d2f4636f 100644 --- a/src/React.Web/AspNetCache.cs +++ b/src/React.Web/AspNetCache.cs @@ -10,7 +10,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Web; using System.Web.Caching; namespace React.Web @@ -28,10 +27,10 @@ public class AspNetCache : ICache /// /// Initializes a new instance of the class. /// - /// The HTTP context - public AspNetCache(HttpContextBase context) + /// The Web application cache + public AspNetCache(Cache cache) { - _cache = context.Cache; + _cache = cache; } /// @@ -62,8 +61,9 @@ public AspNetCache(HttpContextBase context) /// will be cleared automatically /// public void Set( - string key, T data, - TimeSpan slidingExpiration, + string key, + T data, + TimeSpan slidingExpiration, IEnumerable cacheDependencyFiles = null ) { diff --git a/src/React.Web/AspNetFileSystem.cs b/src/React.Web/AspNetFileSystem.cs index a29e928f2..3dfd2c39c 100644 --- a/src/React.Web/AspNetFileSystem.cs +++ b/src/React.Web/AspNetFileSystem.cs @@ -7,7 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -using System.Web; +using System.Web.Hosting; namespace React.Web { @@ -17,20 +17,6 @@ namespace React.Web /// public class AspNetFileSystem : FileSystemBase { - /// - /// The ASP.NET server utilities - /// - private readonly HttpServerUtilityBase _serverUtility; - - /// - /// Initializes a new instance of the class. - /// - /// The server utility. - public AspNetFileSystem(HttpServerUtilityBase serverUtility) - { - _serverUtility = serverUtility; - } - /// /// Converts a path from an application relative path (~/...) to a full filesystem path /// @@ -38,7 +24,7 @@ public AspNetFileSystem(HttpServerUtilityBase serverUtility) /// Full path of the file public override string MapPath(string relativePath) { - return _serverUtility.MapPath(relativePath); + return HostingEnvironment.MapPath(relativePath); } } } diff --git a/src/React.Web/AssemblyRegistration.cs b/src/React.Web/AssemblyRegistration.cs index 12f93886e..000be4a72 100644 --- a/src/React.Web/AssemblyRegistration.cs +++ b/src/React.Web/AssemblyRegistration.cs @@ -9,6 +9,7 @@ using System.Diagnostics; using System.Web; +using System.Web.Caching; using System.Web.Hosting; using React.TinyIoC; @@ -47,7 +48,7 @@ public void Register(TinyIoCContainer container) } else { - container.Register().AsPerRequestSingleton(); + container.Register().AsPerRequestSingleton(); } // Wrappers for built-in objects @@ -55,6 +56,7 @@ public void Register(TinyIoCContainer container) container.Register((c, o) => c.Resolve().Server); container.Register((c, o) => c.Resolve().Request); container.Register((c, o) => c.Resolve().Response); + container.Register((c, o) => HttpRuntime.Cache); } ///