2
votes

I used Visual Studio 2010 to create a new project based on the Web Application template.

I changed nothing. Note that Login.aspx and Default.aspx both reference the same Site.Master master page in the website root folder. And the Site.Master refers to the CSS sheet using a relative URL "~/Styles/Site.css"

Doesn't the tilde refer to "your current location" as identified by the web page?

Since the Login.aspx page and the Default.aspx pages are both in different folders and yet they both use the same Master page, how can this relative url correctly point to the CSS page be correct in both cases?

enter image description here

Note the solution explorer:

3

3 Answers

3
votes

In this case the tilda is the root folder for your application.

So referr to the specific folder name that the file resides after the ~/

2
votes

No. The tilde refers to the root folder of the web application. If you want your current location, use ./ or simply omit the ~/ altogether. But in this case, it just refers to your project.

2
votes

the tilde represents the root of the application regardless of whether is deployed as a virtual directory or not