Always learn something new. I really didn't know that.
I paid some attention to my MasterPage and the link to CSS file. Here is what I noticed.
The default Site.Master has this markup:
It means pages like these would have the CSS:
How come?
The answer is Url Rebasing - the feature of the master pages.
The runtime will try to “rebase” relative URLs it finds on server-side controls inside a master page and paths it finds inside of the head tag.
I paid some attention to my MasterPage and the link to CSS file. Here is what I noticed.
The default Site.Master has this markup:
<head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="../../Content/Site.css" rel="stylesheet" type="text/css" /> </head>I expected the link href will always be static as it is set: "../../Content/Site.css"
It means pages like these would have the CSS:
- Home/One/Index.aspx
- Home/Two/Index.aspx
- Product/One/Edit.aspx
- Home/Index.aspx
- Home/Two/Three/Index.aspx
- Product/Category/One/Edit.aspx
How come?
The answer is Url Rebasing - the feature of the master pages.
The runtime will try to “rebase” relative URLs it finds on server-side controls inside a master page and paths it finds inside of the head tag.