asp.net mvc script and style references

Posted by tom on Stack Overflow See other posts from Stack Overflow or by tom
Published on 2010-05-11T17:52:04Z Indexed on 2010/05/11 22:44 UTC
Read the original article Hit count: 227

Filed under:
|
|
|

I'm trying to include script and style references that will not break on deployment, however I can not even get the references to work locally. I have tried using Url.Content() and MVCContrib's <%=Html.ScriptInclude("")%>.

My scripts are in a Scripts folder on the root of the site; my styles are in the usual Content/css/ folder.

The scripts render like this:

<script type="text/javascript" src="/Scripts/MicrosoftAjax.debug.js" ></script>

This will not work in a view page in the Views folder. What am I doing wrong and what is the best way to handle this?

I would have thought Url.Content() would at least work for styles but used in my master page, the link rendered

<link href="/Content/css/Site.css rel="stylesheet" type="text/css" /> 

This does not work, because the Master Page is in a Shared folder, so what is really the way forward with this?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about mvc