mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Cherry picked 1e83068b8c
.
This commit is contained in:
@@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user