Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 529
  • Last Modified:

ASP.NET images showing on IE but not firefox

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
samelamin
Asked:
samelamin
  • 15
  • 11
  • 3
1 Solution
 
zadeveloperCommented:
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
 
robastaCommented:
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
 
samelaminAuthor Commented:
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
robastaCommented:
remove the tilde (~)

0
 
samelaminAuthor Commented:
i did that as well
nothing yet mate
0
 
samelaminAuthor Commented:
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
 
robastaCommented:
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
 
samelaminAuthor Commented:
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
 
robastaCommented:
try this one:

Response.Write("<img src='/img/img2/logo.jpg' alt='Rob Technologies Logo' border='0' class='logo'> <br>");
0
 
samelaminAuthor Commented:
nope that doesnt work either
it doesnt even work on IE
0
 
samelaminAuthor Commented:
i should say that i created the img and img2 directory
0
 
robastaCommented:
post your code, so i can go through it
0
 
samelaminAuthor Commented:
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
 
robastaCommented:
<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
 
samelaminAuthor Commented:
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
 
robastaCommented:
Is your page on this location :

http://172.21.2.5:82/GenericErrorPage.aspx
0
 
samelaminAuthor Commented:
yup thats right
0
 
robastaCommented:
Can you view the image in the Designer?
--from the <asp:Image...> control
0
 
samelaminAuthor Commented:
yes i can
0
 
robastaCommented:
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
 
samelaminAuthor Commented:
it runs in IE but not Google Chrome and firefox
0
 
robastaCommented:
In Firefox/Chrome, Run the page, press CNTRL+U, then post the code here
0
 
samelaminAuthor Commented:
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
 
robastaCommented:
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
 
samelaminAuthor Commented:
but they are showing images everywhere
this is very strange
ok thanks for your help anyways
0
 
zadeveloperCommented:
Is this page on the net by any chance?
0
 
samelaminAuthor Commented:
no i am hosting it on my DCs IIS
0
 
zadeveloperCommented:
What is the image src value on the rendered page where the image is not shown
0
 
samelaminAuthor Commented:
I have solved it by creating the image on the applications folder

thank u all for your help
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 15
  • 11
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now