Link to home
Start Free TrialLog in
Avatar of bob_mechler
bob_mechlerFlag for United States of America

asked on

Images in sub folder won't load in IIS 7

The following code shows the graphic if located in the root directory and will not show the graphic in the images folder.  Windows Standard 2008 64 bit with .NET 2.0



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>IIS7</title>
<style type="text/css">
<!--
body {
	color:#000000;
	background-color:#B3B3B3;
	margin:0;
}

#container {
	margin-left:auto;
	margin-right:auto;
	text-align:center;
	}

a img {
	border:none;
}

-->
</style>
</head>
<body>
<div id="container">
<img src="/Images/welcome.png" alt="IIS7" width="571" height="411" />
<img src="Logo_Main.gif" alt="Logo_Main" />
</div>
</body>
</html>

Open in new window

Avatar of Michael Machie
Michael Machie
Flag of United States of America image

Take the leading '/' off the '/Images/welcome.png' . Works fine and shows the Welcome.Png file to the left of the Logo_Main file.

As it sits, you will currently see the alt name of IIS7 to the left of the Logo_Main where you actually want welcome.png to show. The link to the file is not understood and my html editor shows a broken link for that reference.  Remove that slash and it will show fine.
Avatar of bob_mechler

ASKER

Made the change, cleared all browser history and did not change on either Chrome or IE
Revised code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>IIS7</title>
<style type="text/css">
<!--
body {
	color:#000000;
	background-color:#B3B3B3;
	margin:0;
}

#container {
	margin-left:auto;
	margin-right:auto;
	text-align:center;
	}

a img {
	border:none;
}

-->
</style>
</head>
<body>
<div id="container">
<img src="Images/welcome.png" alt="IIS7" width="571" height="411" />
<img src="Logo_Main.gif" alt="Logo_Main" />
</div>
</body>
</html>

Open in new window


Any other ideas?
Under Roles for this Windows Standard (not R2) 2008 Server 64 bit there are the following roles besides Web IIS
1. Active Directory Domain Services
2. DNS Server
3. File Services.

Would any of these require more specific permission granting?
Not sure what to say. I replicated your scenario and also replicated the fix I sugested. I tested with both IE11 and I think Firefox32.

Is this Server local to you or hosted by someone? I have seen a hosted server refresh the code on intervals before, which would cause a delay in seeing your changes on the live site. This would not take hours though, more like minutes.
It's a leased server (one of several) accessed via an external IP address using RDP. I'm running my test inside IIS 7 and on IE, Chrome as localhost. The app is just a slightly modifiied iisstart.htm Default website.

Tried it again this morning with the same results. Someone else set up the server. I've even tried uninstalling WEB IIS and re-installing. This server is also used as a company wide FTP Server. (Which I've argued against). If I have to grant more permissions to the sub folders, I just need to know exactly how to do it.
I dont actually know why you cannot view it. I am a local admin on my laptop and saw it fine loading it all locally.
Ill put these files up on one of my hosted and one of my local web servers and see if there is any difference or something noticeable to me.
I appreciate it. I'm currently uninstalling the Web IIS Role so I can reinstall it and make careful notes of each item I'm including in the install. Originally I thought it was because I was installing a ASP.NET 1.1 app the day before to see if it would run on the 64 bit machine. It would run  once I set up the ASP.NET 1.1 APP POOL except for images and CSS which were both in sub folders. The bin, xsl and template files were all in sub folders and they worked fine.

The only 64 bit Windows Standard 2008 machines that worked without a hitch were Web only versions of the software.

I rolled IIS back to nothing but the default web site and changed the iisstart.htm to have the welcome.png in a sub folder and another random graphic in the root folder. That is where I am now.
Ok, ill see what I come up with and let you know.
After reinstalling WEB IIS 7 on the Windows 2008 Standard 64 bit and reinstaling my application as DefaultAppPool it looks like the attachments.
screenshot.bmp
defaultwebsite.bmp
Screenshot.bmp shows an application where all graphics are in a sub folder titled \Images and all CSS files are in a sub folder named \CSS. defaultwebsite.bmp is kind of my control since I started with iisstart.htm and just added one image to  subfolder. The Image in the root folder loads but the one image in the subfolder does not.
Here is the code again for the default web site.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>IIS7</title>
<style type="text/css">
<!--
body {
	color:#000000;
	background-color:#B3B3B3;
	margin:0;
}

#container {
	margin-left:auto;
	margin-right:auto;
	text-align:center;
	}

a img {
	border:none;
}

-->
</style>
</head>
<body>
<div id="container">
<img src="Images/welcome.png" alt="IIS7" width="571" height="411" />
<img src="Logo_Main.gif" alt="Logo_Main" />
</div>
</body>
</html>

Open in new window

This is an odd one.. I was able to copy your code exactly, set up folders as your code points to, name some graphics with the same names, and everything loaded for me fine. I even uploaded it to one of my Web Servers exactly the way I have it described and here is the link:
Test from one of my webservers using your code

Obviously my pics are not yours, but I renamed them exactly the way you have it.
1) I created a 'IIStest' folder.
2) Within this folder I dropped in your code saved as index.html, dropped in the pic named Logo_Main.gif, and created a folder called 'Images'
3) Inside the Images folder I dropped in a pic named welcome.png (see Pic1)
User generated image4) I double-clicked the 'index.html' file and Pic2 is what I get in FireFox - exactly what you wanted to have based on the code you provided.
User generated image
At this point I guess you could ask other Experts for assistance.
Ok. The only differences are the other roles set up in the server manager.
1. Active Directory Domain Services
2. DNS Server
3. File Services.
I didn't set them up, but I can't help but wonder that something in those roles is making everything under InetPub require permissions that it doesn't already have. There is only one of our customers with a Windows 2008 Standard 64 bit server set up as a web server. It works fine. Then again, the only role defined on that server is the Web IIS role.

bob
ASKER CERTIFIED SOLUTION
Avatar of Michael Machie
Michael Machie
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It's not a virtual directory. Thanks for additional things to try. I do remember that some web sites I've encountered didn't act right until I accessed them via an external ip address.

I'll also try the Everyone approach and report back. I'm lacking in the permissions dept as well as how to set the pool to run as anything other than a network service. ApplicationPoolIdentity was not available which seemed odd.
Excellent effort. My bad for missing a spelling error in the default web site's physical directory.
Great job finding the underlying issue! Sometimes it is the smallest things that cause us the most problems haha.