~ explication

  • Thread starter Thread starter Vantroeyen
  • Start date Start date
~ is the home directory on Unix.

I don't really know what it can mean in a URL, though (which user?)

Bruno.
 
Vantroeyen said:
Hello,

What is the meaning of the ~ caracter in a Url

ex: "~/folder/..." ?
In the context of an ASP.NET application ~ stands for the application
directory and most properties and methods using url will replace ~ with the
application root virtual path during rendering. This is very useful if you
want to reference a ressource without knowing the name of the application
directory.

Instead of writing urls like:
/myapp/images/ok.gif -> that could fail if myapp is once moved to
/allapps/myapp...
/images/ok.gif -> same problem
.../../images/ok.gif -> relative urls not always accepted and problems if the
owner page is moved

You would write :
~/images/ok.gif

I have tested this kind of urls for :
HttpResponse.Redirect
Hyperlink.ImageUrl, HyperLink.NavigateUrl
Image.ImageUrl

But I could not manage to find a proper documentation on this behaviour.

Hope it helps.
DK
 
Back
Top