Take the 2-minute tour ×

What are the differences between ./, ../, and ~/ for specifying an image in my web application?

Like current directory, root, parent directory, etc.

share|improve this question
i think its always better to first google for it. because its really very easy to find it on google. –  Rajesh Rolen- DotNet Developer Nov 16 '10 at 6:59
+1 Good question –  Chuck Conway Nov 16 '10 at 7:07
add comment

3 Answers

"./"  //the current directory
"../" //the parent directory
"/"   //the site root directory
"~/"  //virtual root Web path
share|improve this answer
+1 for definitions, please provide any example for understanding this much better. –  Zain Shaikh Nov 16 '10 at 7:05
add comment

ASP.NET Web Project Paths is a very good article in MSDN regarding paths in ASP.NET with good examples.

share|improve this answer
add comment

Web Pathing:
./ means this folder, equivalent to nothing on the front
ex: ./image.jpg and image.jpg are the same thing
/ the web application root folder
ex: /Test/image.jpg, go to the application root, find folder Test, find image.jpg
../ means up one folder then go to the folder after the slash...
ex: ../Test/image.jpg, go up one folder from the current folder your in, go into folder Test, and find image.jpg.

Physical Pathing:
~/ means the application physical root folder. This will not work if you are using it directly in the webpage (ex: <img src="~/images/image.jpg" />). You can use ResolveUrl to get the web path to a file. I have used this for referencing JavaScript libraries in a master page. I've also seen it used in some custom uploaders.

share|improve this answer
add comment

Your Answer


