Referencing stylesheets in a MasterPage
asp.net, css, html, webforms
Solution
You need to specify a non ambiguous / non current relative path:
<link rel="Stylesheet" type="text/css" href="~/Styles/Site.css" />
Problem
How would I go about adding a link to a stylesheet in a MasterPage? Here is the directory sturcture of my website: ``` > MasterPages - Site.master > Styles - Site.css > Default.aspx > Admin - Admin.aspx ``` If I add a reference to my stylesheet in the MasterPage as: ``` <link rel="Stylesheet" type="text/css" href="Styles/Site.css" /> ``` Everything works well in Default.aspx. But if I use the same MasterPage for the Admin.aspx page, the stylesheet cannot be found because it is looking in the wrong directory. How would I go about this? I've tried putting runat="server" in the stylehseet reference, but that doesn't seem to work