Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public static string MapPath (string virtualPath)
  2. {
  3. if (virtualPath == null || virtualPath == "")
  4. throw new ArgumentNullException ("virtualPath");
  5. HttpContext context = HttpContext.Current;
  6. HttpRequest req = context == null ? null : context.Request;
  7. if (req == null) // ADDED for Orchard
  8. {
  9. var pp = HostingEnvironment.ApplicationPhysicalPath;
  10. String vp=virtualPath;
  11. if (vp.IndexOf("~/") == 0)
  12. {
  13. vp = pp + virtualPath.Substring(2);
  14. }
  15. // TODO: if not "~/" ???? then what?
  16. return vp;
  17. } // END added for Orchard
  18. else
  19. return req.MapPath (virtualPath);
  20. }