Resolve site url

  • Thread starter Thread starter CJF
  • Start date Start date
C

CJF

Sometimes the tilde ~ won't work to resolve the url of the asp.net site,
such as when I need to set the path to an image property in vb.net. When
this is the case how can I get the URL to the project's site?

Thanks, Chris
 
Not sure what you mean by "sometimes the ~ does not work"

Anyway you can use
Request.ApplicationPath to get the path.

George.
 
It means the tilde is set literally into the property.
img1.imageurl = "~/images/img.gif"

View the html source of the resulting page and the image's property reads
"~/images/img.gif" and not http://mysite.com/images/img.gif.

Thanks for the info.
 

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

Back
Top