Is there any way to get HttpContext.Current.Request.Url.Host
and HttpContext.Current.Request.ApplicationPath
in one call?
Something like "full application url"?
EDIT: Clarification - what I need is this the part within []:
http://[www.mysite.com/mywebapp]/Pages/Default.aspx
I ask simply out of curiosity.
EDIT 2: Thanks for all the replies, but none of them were exactly what I was looking for. FYI, I solved the problem this way (but am still interested in knowing if there's a smoother way):
public string GetWebAppRoot()
{
if(HttpContext.Current.Request.ApplicationPath == "/")
return "http://" + HttpContext.Current.Request.Url.Host;
else
return "http://" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath;
}