diff --git a/AssemblyVersion.cs b/AssemblyVersion.cs index be2b2df..1a731a3 100644 --- a/AssemblyVersion.cs +++ b/AssemblyVersion.cs @@ -16,5 +16,5 @@ using System.Reflection; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.3.555")] -[assembly: AssemblyFileVersion("3.0.3.555")] +[assembly: AssemblyVersion("3.0.3.556")] +[assembly: AssemblyFileVersion("3.0.3.556")] diff --git a/Core/UrlTools.cs b/Core/UrlTools.cs index 97e5341..e370076 100644 --- a/Core/UrlTools.cs +++ b/Core/UrlTools.cs @@ -132,9 +132,15 @@ namespace ScrewTurn.Wiki { if(tempString.StartsWith("++")) return tempString.Substring(2); - string nspace = HttpContext.Current.Request["NS"]; - if(string.IsNullOrEmpty(nspace)) nspace = null; - if(nspace == null) nspace = GetCurrentNamespace(); + string nspace = null; + if(HttpContext.Current != null) { + // HttpContext.Current can be null when executing asynchronous tasks + // The point is that BuildUrl is called without namespace info only from the web application, so HttpContext is available in that case + // When the context is not available, in all cases BuildUrl is called by the formatter, that has already included namespace info in the URL + nspace = HttpContext.Current.Request["NS"]; + if(string.IsNullOrEmpty(nspace)) nspace = null; + if(nspace == null) nspace = GetCurrentNamespace(); + } if(string.IsNullOrEmpty(nspace)) nspace = null; else nspace = Pages.FindNamespace(nspace).Name;