Search code examples
iiswebformsdocument-root

IIS: Configure document root per site?


I'm using ASP.NET Web Forms and have a Master page that references a view script resources:

<script type="text/javascript" src="/Resources/Scripts/jquery.placeholder.min.js"></script>
<script type="text/javascript" src="/Resources/Scripts/bootstrap.min.js"></script>
<script type="text/javascript" src="/Resources/Scripts/helper.js"></script>

The problem is that the document root "/" works totally fine the dev box but breaks the references on the IIS, because the site is not at the root level anymore. What's the best way to fix this?

Also thought about something like this

<script type="text/javascript" src="<% Server.MapPath("~"); %>/Scripts/jquery-ui-1.9.0.min.js"></script>

or

<script type="text/javascript" runat="server" src="~/Scripts/jquery-ui-1.9.0.min.js"></script>

but both throw errors. I think this is a typical scenario and I would like to know how you guys do this?


Solution

  • user this

     <script type="text/javascript" src='<%= ResolveUrl("~/Scripts/jquery-1.4.1.js")%>'></script>
    



    Here is a post which may help your. ResolveUrl not working inline