tags:

views:

39

answers:

1

Does anyone know how I might programmatically discover the current page's full address. We share our codebase accross several clients in subdomains and I am trying to discover which client is viewing the page in order to load appropriate CSS, eg. red.website.com; blue.website.com; (I am looking to grab the red or blue, in my code).

Many thanks. Apologies for the poor wording.

+1  A: 

The full path should be: Request.Url.AbsoluteUri?

Once you have a Uri (simply Resuest.Url), something like:

string color = uri.Host.Split('.')[0];
Marc Gravell
very fast response and dead on. Thanks so much!Request.Url.AbsoluteUri.Split(".")(0) Was the VB 2.0 command I used.