Fixed issue occurring when calling formatting-related code from asynchronous threads (HttpContext is unavailable).
This commit is contained in:
parent
3574da09ba
commit
d8a68737ab
2 changed files with 11 additions and 5 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("3.0.3.555")]
|
[assembly: AssemblyVersion("3.0.3.556")]
|
||||||
[assembly: AssemblyFileVersion("3.0.3.555")]
|
[assembly: AssemblyFileVersion("3.0.3.556")]
|
||||||
|
|
|
@ -132,9 +132,15 @@ namespace ScrewTurn.Wiki {
|
||||||
|
|
||||||
if(tempString.StartsWith("++")) return tempString.Substring(2);
|
if(tempString.StartsWith("++")) return tempString.Substring(2);
|
||||||
|
|
||||||
string nspace = HttpContext.Current.Request["NS"];
|
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(string.IsNullOrEmpty(nspace)) nspace = null;
|
||||||
if(nspace == null) nspace = GetCurrentNamespace();
|
if(nspace == null) nspace = GetCurrentNamespace();
|
||||||
|
}
|
||||||
if(string.IsNullOrEmpty(nspace)) nspace = null;
|
if(string.IsNullOrEmpty(nspace)) nspace = null;
|
||||||
else nspace = Pages.FindNamespace(nspace).Name;
|
else nspace = Pages.FindNamespace(nspace).Name;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue