0

I've deployed a pair of related web applications to a test IIS 7.5 server. The directory structure in IIS Manager is like so:

IIS7 Directory Structure

The "licensing" application is over http; the "renewal" application is over https. That part works fine. But what's happening (with both applications) is that images, Javascript, and CSS are not being loaded. When I look at the logfile, each image, Javascript, and CSS file is giving a 404 error. The site's directory structure is like so:

BEALicensingTest/
  lookup/
    (ASPX files, etc. are at this level)
    Content/
      (CSS is at this level)
      images/
        (images are at this level)
    Scripts/
      (Javascript files are at this level)
  renewal/
    (ASPX files, etc. are at this level)
    Content/
      (CSS is at this level)
      images/
        (images are at this level)
    Scripts/
      (Javascript files are at this level)

Here's a code sample from the main CSS file for one of the apps:

div#header
{
  background: #f7f3df url('../Content/images/banner.gif') no-repeat left top;
  height: 92px;
  min-width: 800px;
  width: 100%;
  position: relative;
}

Here's a code sample (from the <head> section) from the Master page for one of the apps:

<link rel="stylesheet" type="text/css" href="../Content/BEA.css" />
<%-- jQuery includes --%>
<script type="text/javascript" src="../Scripts/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../Scripts/jquery-ui-1.10.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="../Content/themes/sunny/jquery-ui-1.10.3.custom.min.css" />

And here's an <img> tag from one of the .aspx files:

<img src="../Content/images/cc_logos_vertical.png" alt="credit card logos" width="88"
  height="170" style="float: right; padding-left: 5px;" />

As you can see, I'm using relative paths for everything. I've also tried absolute paths (e.g. /Content/BEA.css).

I've checked permissions (given IIS_IUSRS read permissions on the site's folder based on a similar question at https://serverfault.com/questions/260777/why-isnt-iis-serving-my-static-css-js-files), made sure the Static Content feature is enabled, and tried changing the CAS policy as described in IIS 7.5 no images css js showing. I've also tried "protocol-relative URLs" as described at http://www.paulirish.com/2010/the-protocol-relative-url/. Nothing I've tried makes any difference.

What am I doing wrong?

EDIT: I experimented some more and found that if I prepended all the image, CSS, and Javascript references with the application subfolder like this: /lookup/Content/images/banner.gif and /renewal/Scripts/jquery-1.10.2.min.js they started working. So when I thought I was using absolute paths: /Content/images/banner.gif, I really wasn't.

However, now that I've changed the references, the images, etc. don't load when I'm debugging in Visual Studio 2012. I understand why, but is there anything I can do so I can have it work both ways?

Community
  • 1
  • 1
timbck2
  • 1,036
  • 3
  • 15
  • 36

0 Answers0