This commit is contained in:
Sipke Schoorstra
2015-05-28 00:59:48 +02:00
parent f0cd135993
commit c9887f4d39

View File

@@ -22,18 +22,12 @@ namespace Orchard.Mvc {
var httpContext = HttpContext.Current; var httpContext = HttpContext.Current;
if (httpContext == null) { if (httpContext == null) {
return null; return null;
} }
try { public HttpContextBase Current() {
// The "Request" property throws at application startup on IIS integrated pipeline mode. // TODO: HttpContextBase is not registred in the "shell" lifetime scope, so resolving it will cause an exception.
if (httpContext.Request == null) {
return null; return HttpContext.Current != null ? new HttpContextWrapper(HttpContext.Current) : null;
}
}
catch (Exception) {
return null;
}
return httpContext;
} }
} }
} }