does using ~/ in a file path resolve to the root of the current folder or the website?
I have a file structure as such:
\
->Folder
-->Page1.Aspx
->App_Themes
-->Theme1
--->Images
--->StyleSheet.css
->Includes
-->Footer.htm
Default.aspx
Default.master
I am using my default.master page for Page1.aspx and default.aspx. The master page uses <!-- #include file="includes/Footer.htm" --> . Then in my Footer.html i use paths for images such as : ~/App_Themes/Theme1/Images/Image1.png”.
The image will display properly in default.aspx but will not be found in Page1.aspx. I thought ~/ meant root of the website when used in a file path?
EDIT:
I was wrong, it is also not working in defaut.aspx. The path that was working is: /App_Themes/Theme1/Images/Image1.png.
It resolves to the root of the current web application, which may or may not be the root of the website as a whole.
To understand the difference, see this article.
As a general rule, when you’re creating a “website” or a “web application” in Visual Studio, you’re actually creating a “Web Application” in IIS speak.
To further muddy the waters, Conceptually, the root of the website is an IIS “application” in and of itself, so you can publish your Visual Studio website/web application to the root of your website. In that case, ~/ will refer to the root of the site.
If, however, you’ve got multiple Applications all running in one Site, then in each one the ~/ will refer to the root of that application.
For example, say MySite.com has different applications
In all of the above, mysite.com is the website. but the /* denotes the application. The ~/ will refer to
and
respectively