Created
October 11, 2014 15:17
-
-
Save tuespetre/f333b6bba4f9a8b496bc to your computer and use it in GitHub Desktop.
Postal.Mvc5 HttpContext workaround (issue #73)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Workaround for Postal.MVC5 1.2.0 issue 73 | |
// https://github.com/andrewdavey/postal/issues/73 | |
if (HttpContext.Current == null) | |
{ | |
var baseURL = ConfigurationManager.AppSettings["baseURL"].TrimEnd('/'); | |
var absolute = VirtualPathUtility.ToAbsolute("~/").TrimStart('/'); | |
HttpContext.Current = new HttpContext( | |
new HttpRequest("", baseURL + "/" + absolute, ""), | |
new HttpResponse(new StringWriter()) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment