?
Solved

ASP.NET images showing on IE but not firefox

Posted on 2010-01-12
29
Medium Priority
?
521 Views
Last Modified: 2013-11-27
Hey all
I am getting a really weird error,i am trying to show a logo on my web application and for some reason the logo is shown on IE but not forefox or chrome

whats weird is that if i click on open new window on chrome it shows it

after research people suggested i should use forward slashes instead of back slashes but that hasnt worked

i should say that i am using responce.write to create the image

   Response.Write("<img src=\\\\ATL-WINDOWS1\\c$\\logo\\logo.jpg alt=Altman Technologies Logo border=0 class=logo> <br>");
0
Comment
Question by:samelamin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 15
  • 11
  • 3
29 Comments
 
LVL 13

Expert Comment

by:zadeveloper
ID: 26295054
try

Response.Write("<img src=\\ATL-WINDOWS1\\c$\\logo\\logo.jpg alt=Altman Technologies Logo border=0 class=logo> <br>");

Open in new window

0
 
LVL 14

Expert Comment

by:robasta
ID: 26301714
You are referencing an image on a Windows Network (\\server\dir\dir...), this works in IE but not in Firefox.

I suggest you include the image in a sub-directory on the site. I would recommend you add an "~/img" directory, then add the logo inside that directory.

You can then reference it like this:

Response.Write("<img src=/img/logo.jpg alt=Altman Technologies Logo border=0 class=logo> <br>");
0
 

Author Comment

by:samelamin
ID: 26301866
what exactly do you mean robasta
so create a directory in my main webapplication and insert a logo in it

what i did it is i created a logo directory and inserted a logo in it
heres the call
 Response.Write("<img src=~/logo/logo.jpg alt=Altman Technologies Logo border=0 class=logo> <br>");
but its still no working
0
Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

 
LVL 14

Expert Comment

by:robasta
ID: 26301891
remove the tilde (~)

0
 

Author Comment

by:samelamin
ID: 26301900
i did that as well
nothing yet mate
0
 

Author Comment

by:samelamin
ID: 26301918
whats really strange is that if i reference it on the windows network it wont appear on google chrome

but when i open it on a new tab the image is shown
0
 
LVL 14

Accepted Solution

by:
robasta earned 2000 total points
ID: 26302042
Is the asp page also in the root?

Files structure should be like:

root/page.aspx
root/logo/logo.jpg

Then this will work:
 Response.Write("<img src=/logo/logo.jpg alt=Altman Technologies Logo border=0 class=logo> <br>");

Here's an explanation why it wont work as expected in other browsers, (esp FF): http://rubenlaguna.com/wp/2007/04/20/firefox-and-file-windows-unc-paths/


Also, Do you have a DOCTYPE declaration on your page?
0
 

Author Comment

by:samelamin
ID: 26302163
yes thats the file structure
yes i do it works on visual studio when i run it on google

and yes i do have a doctype decleration
0
 
LVL 14

Expert Comment

by:robasta
ID: 26302316
try this one:

Response.Write("<img src='/img/img2/logo.jpg' alt='Rob Technologies Logo' border='0' class='logo'> <br>");
0
 

Author Comment

by:samelamin
ID: 26302353
nope that doesnt work either
it doesnt even work on IE
0
 

Author Comment

by:samelamin
ID: 26302357
i should say that i created the img and img2 directory
0
 
LVL 14

Expert Comment

by:robasta
ID: 26302477
post your code, so i can go through it
0
 

Author Comment

by:samelamin
ID: 26302504
here is the generic error page
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GenericErrorPage.aspx.cs" Inherits="Webstation.GenericErrorPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>
    
   
</title>
</head>
<body>
    <form id="form1" runat="server">
      <asp:Image ID="Logo"
runat="server"
AlternateText="Logo"
ImageUrl="\\ATL-WINDOWS1\c$\logo\logo.jpg"/>

    <div>
        <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
    <br />
   <asp:LinkButton ID="LinkButton2" Font-Size=10 Font-Names=verdana runat="server" 
         onclick="LinkButton2_Click">Job Details</asp:LinkButton>
    
     &nbsp;
      
   <asp:LinkButton ID="LinkButton3" Font-Size=10 Font-Names=verdana runat="server" 
         onclick="LinkButton3_Click">Upload Client</asp:LinkButton>
    
    <br />
    

    <br />
  
    
     <asp:LinkButton ID="LinkButton1" Font-Size=10 Font-Names=verdana runat="server" 
         onclick="LinkButton1_Click">Logout</asp:LinkButton>

 <br />
   © Altman Technologies Ltd - 2009
    </form>

</body>
</html>

    </div>
    </form>
</body>
</html>

Open in new window

0
 
LVL 14

Expert Comment

by:robasta
ID: 26302557
<asp:Image ID="Logo"
runat="server"
AlternateText="Logo"
ImageUrl="\\ATL-WINDOWS1\c$\logo\logo.jpg"/>


should be:

 <asp:Image ID="Logo"
runat="server"
AlternateText="Logo"
ImageUrl="~/logo/logo.jpg"/>
0
 

Author Comment

by:samelamin
ID: 26302580
it still isnt showing
when i open it in a new tab
http://172.21.2.5:82/logo/logo.jpg

this is the address that is produced
0
 
LVL 14

Expert Comment

by:robasta
ID: 26302653
Is your page on this location :

http://172.21.2.5:82/GenericErrorPage.aspx
0
 

Author Comment

by:samelamin
ID: 26302828
yup thats right
0
 
LVL 14

Expert Comment

by:robasta
ID: 26302866
Can you view the image in the Designer?
--from the <asp:Image...> control
0
 

Author Comment

by:samelamin
ID: 26302871
yes i can
0
 
LVL 14

Expert Comment

by:robasta
ID: 26302924
That means you should be able to view the image in IE.  Which browsers are not showing the images now?

Run the page and show the markup that is generated.
0
 

Author Comment

by:samelamin
ID: 26302938
it runs in IE but not Google Chrome and firefox
0
 
LVL 14

Expert Comment

by:robasta
ID: 26302974
In Firefox/Chrome, Run the page, press CNTRL+U, then post the code here
0
 

Author Comment

by:samelamin
ID: 26303007
here
<font size=2 face=Verdana>Welcome to Altman Technologies.<BR><script> alert('Error 7. Error. Please Contact your network administrator');</script> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head><title> 
	
    
   
 
</title></head> 
<body> 
    <form name="form1" method="post" action="GenericErrorPage.aspx" id="form1"> 
<div> 
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /> 
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /> 
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJMjI1NTg2OTgxZGTrzPhbWkf2EVTSqOR4CeRY+TruZg==" /> 
</div> 
 
<script type="text/javascript"> 
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script> 
 
 
<div> 
 
	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBALK7aG5BAKxi96RBQKWosD8CgLM9PumD9QoG6xO4mqNecYl4c7DJ3XSx94D" /> 
</div> 
       <img id="Logo" src="logo/logo.jpg" alt="Logo" style="border-width:0px;" /> 
      <br /> 
      <br /> 
 
    <div> 
         <br /> 
   <a id="LinkButton2" href="javascript:__doPostBack('LinkButton2','')" style="font-family:verdana;font-size:10pt;">Job Details</a> 
    
     &nbsp;
      
   <a id="LinkButton3" href="javascript:__doPostBack('LinkButton3','')" style="font-family:verdana;font-size:10pt;">Upload Client</a> 
    
    <br /> 
    
 
    <br /> 
  
    
     <a id="LinkButton1" href="javascript:__doPostBack('LinkButton1','')" style="font-family:verdana;font-size:10pt;">Logout</a> 
 
 <br /> 
   © Altman Technologies Ltd - 2009
    </form> 
 
</body> 
</html> 
 
    </div> 
    </form> 
</body> 
</html>

Open in new window

0
 
LVL 14

Expert Comment

by:robasta
ID: 26303154
This code runs as expected in my Firefrox and Chrome.

Then, it should be that your browsers are not displaying images (check your settings or try a site with images in FF/Chrome)
0
 

Author Comment

by:samelamin
ID: 26303167
but they are showing images everywhere
this is very strange
ok thanks for your help anyways
0
 
LVL 13

Expert Comment

by:zadeveloper
ID: 26303628
Is this page on the net by any chance?
0
 

Author Comment

by:samelamin
ID: 26303637
no i am hosting it on my DCs IIS
0
 
LVL 13

Expert Comment

by:zadeveloper
ID: 26305916
What is the image src value on the rendered page where the image is not shown
0
 

Author Comment

by:samelamin
ID: 26435768
I have solved it by creating the image on the applications folder

thank u all for your help
0

Featured Post

Quick Cloud Training

Looking for some quick training on the cloud in 2 hours or less? Check out these how-to guides in AWS, Linux, OpenStack, Azure, and more!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question