
Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
Request.ServerVariables["SERVER_NAME"]; and Request.Url.Host return the same object, right ?
You're missing the application's name and the port, per the OP's request, though.
There's many ways to skin a cat.
Dim fullappname as string = Request.Url.Host
Dim port as string = Request.ServerVariables("SERVER_PORT")
Dim prot as object = IIf(Request.ServerVariables("HTTPS")="on", "https://", "http://")
Dim path as String = prot.ToString() & fullappname & ":" & port & Request.ApplicationPath
...will also do the job.
:-)
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
>>I don't have a server certificate handy to test this, but this should cover that :
> I normally use something like this:
> string strWebRoot = (Request.ServerVariables["HTTPS"] == "off" ? "http://" : "https://") +
> Request.ServerVariables["SERVER_NAME"];
Mark Rae [MVP] - 03 Aug 2007 14:28 GMT
> Request.ServerVariables["SERVER_NAME"]; and Request.Url.Host return the
> same object, right ?
Yes - AFAIK, Request.Url is just a wrapper around Request.ServerVariables...
> You're missing the application's name and the port, per the OP's request,
> though.
Probably... :-)
> There's many ways to skin a cat.
>
[quoted text clipped - 6 lines]
>
> ...will also do the job.
Indeed.

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net