With a runat="server" attribute, paths like this:
~/Main.css
are expanded to the proper application's root folder at run-time. So, if you have an app called MyApp, then ~/Main.css will expand to:
http://localhost/MyApp/Main.css
This path works from all pages in your site, as it's root relative.
/Main.css won't work as it points to
http://localhost/Main.css.
~/Main.css won't work without the runat attribute because you'll end up with this in the browser:
http://localhost/~Main.css
which obviously isn't a valid path.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out
this post.