Skip to content

Commit

Permalink
Resolve ASP.NET environments without HTTP contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
coka committed Oct 31, 2017
1 parent 36c653f commit c483edd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
5 changes: 2 additions & 3 deletions src/React.Web/AspNetCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ public class AspNetCache : ICache
/// <summary>
/// Initializes a new instance of the <see cref="AspNetCache"/> class.
/// </summary>
/// <param name="context">The HTTP context</param>
public AspNetCache(HttpContextBase context)
public AspNetCache()
{
_cache = context.Cache;
_cache = HttpRuntime.Cache;
}

/// <summary>
Expand Down
18 changes: 2 additions & 16 deletions src/React.Web/AspNetFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -17,28 +17,14 @@ namespace React.Web
/// </summary>
public class AspNetFileSystem : FileSystemBase
{
/// <summary>
/// The ASP.NET server utilities
/// </summary>
private readonly HttpServerUtilityBase _serverUtility;

/// <summary>
/// Initializes a new instance of the <see cref="AspNetFileSystem"/> class.
/// </summary>
/// <param name="serverUtility">The server utility.</param>
public AspNetFileSystem(HttpServerUtilityBase serverUtility)
{
_serverUtility = serverUtility;
}

/// <summary>
/// Converts a path from an application relative path (~/...) to a full filesystem path
/// </summary>
/// <param name="relativePath">App-relative path of the file</param>
/// <returns>Full path of the file</returns>
public override string MapPath(string relativePath)
{
return _serverUtility.MapPath(relativePath);
return HostingEnvironment.MapPath(relativePath);
}
}
}

0 comments on commit c483edd

Please sign in to comment.