views:

300

answers:

1

I have a simple but script and css fashioned ASP.NET MVC Application, within the VS2008 Development server everything goes well, but when I bring it to IIS7 I experiment some ugly script and images issues.. Scripts are not found by relative paths (this expecially in the default routed page) and images too.

After some research and googlin' I found many examples and provided solutions, but anything really solves the problem, Someone says one solution soude be using the Url.Content method but I hate to use it because I lost all the javascript intellisense feature in VS2008..

I found too this issue maybe different if the mvc project is shipped in a root web site or in a web application.. I know in a root web site it could works because referencing relative paths like

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

in a web application folder is resolved without the root. Anybody has some suggestion or someting else? I Intend after to start something to build a sort of configuration "guide".. Thaks in advance

+1  A: 

It may have been me that suggested using Url.Content. If so, I neglected the other half of what I do -- wrapping a relative path in an if (false) block to retain intellisense. Below is a (full) example of how I handle javascript.

 <% if (false) { %>
    <script type="text/javascript"
            src="../../Scripts/jquery-1.3.1.min.js">
    </script>
 <% } %>
 <script type="text/javascript"
         src='<% Url.Content( "~/Scripts/jquery-1.3.1.min.js" ) %>'>
 </script>
tvanfosson