Here's the scenario. We have a router that port forwards requests for our different test sites. For example http://www.ourSite.com:8051 forwards from the router to a web server that is on port 80. The test web sites are virtual directories of one web site running on IIS6 (Windows Server 2003).
Part of our application send out e-mails that use a base url to build some links in the application. Here's the base url being built in our on application start:
siteBaseUrl = string.Format("{0}://{1}{2}",
HttpContext.Current.Request.Url.Scheme,
HttpContext.Current.Request.Url.Authority,
HttpContext.Current.Request.ApplicationPath.TrimEnd('/'));
So let's say one of our tests site's looks like this, http://www.ourSite.com:8051/client1. I would expect siteBaseUrl to look like this, http://www.ourSite.com:8051/client1, when in fact it ends up looking like this http://www.ourSite.com/client1 (I tried finding a question like this on StackOverflow but found none. Maybe I wasn't searching with the right keywords, or I need more coffee. Any help on this matter would be greatly appreciated.