Fixed possible issue occurring when multiple namespaces are added to the URL (e.h. Help.Customize.MainPage).

This commit is contained in:
Dario Solera 2009-10-22 12:40:56 +00:00
parent 9e9ceb2ec7
commit e37abcf39f
3 changed files with 8 additions and 4 deletions

View file

@ -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.1.411")]
[assembly: AssemblyFileVersion("3.0.1.411")]
[assembly: AssemblyVersion("3.0.1.412")]
[assembly: AssemblyFileVersion("3.0.1.412")]

View file

@ -317,7 +317,11 @@ namespace ScrewTurn.Wiki {
/// <param name="input">The input string.</param>
/// <returns>The encoded string.</returns>
public static string UrlEncode(string input) {
return HttpContext.Current.Server.UrlEncode(input).Replace("+", "%20");
if(HttpContext.Current != null && HttpContext.Current.Server != null) return HttpContext.Current.Server.UrlEncode(input).Replace("+", "%20");
else {
Log.LogEntry("HttpContext.Current or HttpContext.Current.Server were null (Tools.UrlEncode)", EntryType.Warning, Log.SystemUsername);
return input;
}
}
/// <summary>

View file

@ -28,7 +28,7 @@ namespace ScrewTurn.Wiki {
if(ext != "ashx" && ext != "aspx") return;
// Extract the current namespace, if any
string nspace = GetCurrentNamespace();
string nspace = GetCurrentNamespace() + "";
if(!string.IsNullOrEmpty(nspace)) pageName = pageName.Substring(nspace.Length + 1); // Trim Namespace. from pageName
string queryString = ""; // Empty or begins with ampersand, not question mark