1/// <summary>
2/// Returns the base application url (such as "http://localhost/myweb/").
3/// The url will have a trailing forward slash.
4/// </summary>
5/// <returns></returns>
6private string getBaseUrl(HttpRequest request)
7{
8 StringBuilder url = new StringBuilder();
9 url.Append(request.Url.Scheme);
10 url.Append("://");
11 url.Append(request.Url.Host);
12 if(request.Url.Port != 80)
13 {
14 url.Append(":");
15 url.Append(request.Url.Port);
16 }
17 url.Append(request.ApplicationPath);
18 url.Append("/");
19 return url.ToString();
20}