views:

353

answers:

2

I am running a website on a virtual directory.

The url for the site is http://localhost/virtalDirectory/pages.aspx

I have an image to be loaded on the page from the following directory heirarchy:

parent directory
..images
....my image
..myPage.aspx

My img tag is <img src="images/imageName.gif" alt="some text"/>

When loading in IE8, the images are loaded properly, but when loading in Firefox3 I am prompted to log into localhost and it appears to be a windows file explorer login.

I have a web.config in the images directory:
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>

I have tried changing my image tag to: <img src="~/images/imageName.gif" alt="some text" runat="server"/> to allow asp to resolve the address of the image at run-time. Which does not resolve the problem.

I have tried adding <allow users="?" /> to the image directory web.config. Which does not resolve the problem.

+7  A: 

Have you checked the permissions on the file itself? Most likely, the file permissions are set to you vs. everyone, and IE passes the credentials along but Firefox doesn't.

GalacticCowboy
In the OS. Right-click on the file, "Properties" > "Security"
GalacticCowboy
If you're using IIS and/or your web app to handle access, the file must be readable by the IUSR_<whatever> account.
GalacticCowboy
@GalacticCowboy There is another image in the same directory that is viewable without logging in, that does not have the Security settings updated.
StuperUser
The permissions on the two files are the same?
GalacticCowboy
No they are not, now that I have added Read access to "machineName\Users" FF does not require credentials. Thanks GC!
StuperUser
A: 

This has nothing to do with file permissions, or Microsoft trashing other browsers. There is just a small mistake in your markup, which IE decides to fix for you on the fly, and FireFox chooses not to.

You should use a URI as the value of the src as the HTML standard dictates. Contrary to Windows file paths, URIs use a forward slash (/) instead of a backslash (\) as a hierarchy separator

IE is just more forgiving for the markup mistake and will silently fix up the path. If you want make FireFox act as forgiving as IE, install Slashy.

The most preferable solution by far is to write valid HTML.

<img src="images/imageName.gif" alt="some text"/>
Peter Stuer
Hi Peter, I had included forward slashes in the original image URI, I changed them around when copying the code to the question. I think that because FF was asking for credentials, it had found the correct image file and came up against the permissions rather than just not displaying the images. A VERY good point on the slashes though, that I will be mindful of in future, thank you. I use Validator based on TIDY for FF (http://users.skynet.be/mgueury/mozilla/), but in this case I had neglected to check it, so another very good point. Thanks Peter.
StuperUser