asp.net 2.0 request.url.host

Soldato
Joined
23 Oct 2002
Posts
4,142
Location
_
Hi,

Bit of a stretch posting this here because I know there aren't that many .NET'ers that've been able to help in the past, but here goes!

I'm using a string property in the code-behind of my website that will grab the URL I'm using for building usable links in a website that uses URL rewriting.

The two properties that're used are these:

Code:
public string VirtualRoot
    {
        get
        {
            if (Utils.VirtualRoot == null)
            {
                string virtualRoot = Request.ApplicationPath.TrimEnd('/') + "/";
                Utils.VirtualRoot = virtualRoot;
            }
            return Utils.VirtualRoot;
        }
    }

    public string AppRoot
    {
        get
        {
            if (Utils.AppRoot == null)
            {
                Utils.AppRoot = "http://" + Request.Url.Host + VirtualRoot;
            }
            return Utils.AppRoot;
        }
    }

I'm using multiple URLs on this website, so something like http://www.test.com and http://test.tester.com I build the site locally, but deployed it regularly to http://test.tester.com.

I have now pointed the domain http://www.test.com to my website, which brings up the home page. However, hovering over any of the navigation that uses my two properties above points to http://test.tester.com, even though I arrived on http://www.test.com

Any ideas why this is? I'm utterly clueless! Could it be an IIS-related thing? I'm using IIS 6.0.

Thanks for any help,

Karl.
 
Hey,

I will have a look when I get into work mate... I hope that you can hold out untill then...

Thanks,

Stelly
 
Back
Top Bottom