Reputation: 1
I have the following link inside my asp.net mvc razor view:-
<a class="brand" href="~/Home/Index/"> <img alt="test" src="~/Content/logo.png" /> </a>
But i am not sure what does the symbol ~ inside the src & href do ? as removing this symbol will still reference to the correct imag and the correct url ? can anyone advice please ?
Thanks
Upvotes: 4
Views: 294
Reputation: 3647
http://msdn.microsoft.com/en-us/library/ms178116(v=vs.100).aspx
~
means root
directory of your application.
Following SO post may help to know more.
slash(/) vs tilde slash (~/) in style sheet path in asp.net
In your case removing the ~
from path will make your path absolute. Then the url will become http://example.com/absoulte/path
. If your project root directory and web root is same, it will make no difference. You may also want to visit these links.
http://www.boogiejack.com/server_paths.html
Upvotes: 4
Reputation: 1952
"~" is notation for webroot.. if you have IIS C:/inetpub/wwwroot/ is your webroot..
it has its existence (origin) from UNIX ~
which denotes home directory
Upvotes: 1
Reputation: 1043
~
is your 'home' folder, on Unix it is eg. /home/andy (it is taken from $HOME variable - and it can be set by you to any other folder)
Upvotes: 0
Reputation: 21351
The ~
symbol represents the currently logged in users home directory on a linux/unix system.
Upvotes: 1