Virtual Path "~/" to full Uri

N

Nathan

I need to take a path "~/" and get a http://localhost:port/rootappfolder/
url out of it.

Currently I'm using:
Request.Url.Scheme + "://" + Request.Url.Host + this.ResolveUrl("~/");
//this is run from the context of a user control.

Is this the best way to do this by rebuilding the url from the client
request?

ideas?

Thanks in advance,
Nathan
 
K

Kevin Spencer

Assuming that the scheme is always going to be "http://" you don't need to
get that from the Request.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
N

Nathan

Yeah, I actually ended up using:
Request.Url.Scheme + "://" + Request.Url.Host + ":" +
Request.Url.Port.ToString() + this.ResolveUrl("~/")

I'm trying to make my app portable between dev and production without having
to worry about the path. It's also being generated in a PDF, so I needed to
be able to have a fully qualified path for the link so it could be accessed
from the client directly.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top