#20385 Fixing Logging Bugs

Work Item: 20385
This commit is contained in:
Stanley Goldman
2013-12-26 19:28:55 -05:00
committed by Sebastien Ros
parent dd73289c53
commit 34d6e5198a
2 changed files with 10 additions and 2 deletions

View File

@@ -107,7 +107,15 @@ namespace Orchard.Environment {
public ShellSettings Match(HttpContextBase httpContext) { public ShellSettings Match(HttpContextBase httpContext) {
// use Host header to prevent proxy alteration of the orignal request // use Host header to prevent proxy alteration of the orignal request
return Match(httpContext.Request.Headers["Host"] ?? string.Empty, httpContext.Request.AppRelativeCurrentExecutionFilePath); var httpRequest = httpContext.Request;
if(httpRequest == null) {
return null;
}
var host = httpRequest.Headers["Host"];
var appRelativeCurrentExecutionFilePath = httpRequest.AppRelativeCurrentExecutionFilePath;
return Match(host ?? string.Empty, appRelativeCurrentExecutionFilePath);
} }
public ShellSettings Match(string host, string appRelativePath) { public ShellSettings Match(string host, string appRelativePath) {

View File

@@ -68,7 +68,7 @@ namespace Orchard.Logging {
} }
var ctx = HttpContext.Current; var ctx = HttpContext.Current;
if (ctx != null) { if (ctx != null && ctx.Request != null) {
ThreadContext.Properties["Url"] = ctx.Request.Url.ToString(); ThreadContext.Properties["Url"] = ctx.Request.Url.ToString();
} }
} }