Added GetMainUrl "smart" method.
This commit is contained in:
parent
12c9da210b
commit
8c35eed690
1 changed files with 32 additions and 17 deletions
|
@ -605,6 +605,24 @@ namespace ScrewTurn.Wiki {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the main URL of the wiki, defaulting to the current request URL if none is configured manually.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The URL of the wiki.</returns>
|
||||||
|
public static Uri GetMainUrl() {
|
||||||
|
Uri mainUrl = new Uri(MainUrl);
|
||||||
|
if(mainUrl.Host == "www.server.com") {
|
||||||
|
try {
|
||||||
|
// STW never uses internal URLs with slashes, so trimming to the last slash should work
|
||||||
|
// Example: http://server/wiki/namespace.page.ashx
|
||||||
|
string temp = HttpContext.Current.Request.Url.ToString();
|
||||||
|
mainUrl = new Uri(temp.Substring(0, temp.LastIndexOf("/") + 1));
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
return mainUrl;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the correct path to use with Cookies.
|
/// Gets the correct path to use with Cookies.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -878,14 +896,11 @@ namespace ScrewTurn.Wiki {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IP/Host filter for page editing.
|
/// Gets or sets the IP/Host filter for page editing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string IpHostFilter
|
public static string IpHostFilter {
|
||||||
{
|
get {
|
||||||
get{
|
return GetString(Provider.GetSetting("IpHostFilter"), "");
|
||||||
|
|
||||||
return Provider.GetSetting("IpHostFilter");
|
|
||||||
}
|
}
|
||||||
set
|
set {
|
||||||
{
|
|
||||||
Provider.SetSetting("IpHostFilter", value);
|
Provider.SetSetting("IpHostFilter", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue