views:

22

answers:

1
+1  A: 

You should try using Url.Content() and see if that makes a difference.

Example:

<link href="<%=Url.Content("~/Content/Site.css")%>" rel="stylesheet" type="text/css" />
Kristof Claes
I've tried that one - it gives me a link to "/css/global.css" where it should be "../../css/global.css"
roman
BTW - the problem is only with CSS files. for JS it works fine.
roman
What is the full path of your global.css file?
Kristof Claes
it's at the root of the site with /css/global.css (i.e <root>/css/global.css) - where as the directories are standard MVC dir structure.
roman
If /css/global.css is the full path of your file, and the Url.Content() outputs <link href="/css/global.css" type="text/css" rel="stylesheet" />, then it should work from every page because it's using an absolute url instead of a relative one. Are you sure there isn't some other problem?
Kristof Claes
That's what I've thought - but it seems it's the only problem. If I use the same path but add ../../ - it works. though if I view source and try to go the css file - it works BOTH times. so I seems the browser is able to see the files everytime but doesn't use them for some reason.
roman
I've found the problem... I wrote "ref" instead of "rel"... so sorry for the trouble and thank you VERY much for your help!
roman
the Url.Content was the answer :)
roman