By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

~ explication

P: n/a
Hello,

What is the meaning of the ~ caracter in a Url

ex: "~/folder/..." ?

Regards
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
~ is the home directory on Unix.

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

Bruno.

"Vantroeyen" <N.******************@axilog.fr> a écrit dans le message de
news:02****************************@phx.gbl...
Hello,

What is the meaning of the ~ caracter in a Url

ex: "~/folder/..." ?

Regards

Jul 19 '05 #2

P: n/a
"Vantroeyen" <N.******************@axilog.fr> wrote in message
news:02****************************@phx.gbl...
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

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.