In VB.Net, I used ...
With HttpContext.Current.Request.Url sDomain=.Scheme & System.Uri.SchemeDelimiter & .Host End With
Or if you need a port, then ...
With HttpContext.Current.Request.Url sDomain=.Scheme & System.Uri.SchemeDelimiter & .Host & IIf(.IsDefaultPort,"",":") & .Port End With
Easy to convert to C #;)
barrylloyd
source share