problem with master page and firefox

M

morad.87

This code works properly in IE ,but fire fox doesn't show the image!!



<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!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>Master Page</title>
<style type="text/css">

</style>
</head>
<body style="margin:0;">

<form id="form1" runat="server">
<div>
<center>
<table style="width:100%; background-color:Black; height:75px;"
cellpadding="0px;" cellspacing="0px">
<tr>
<td >
<asp:Image ID="image1" runat="server" ImageUrl="~/Images/
Banner.jpg" AlternateText="banner"/>
</td>
</tr>
</table>
</center>
<asp:contentplaceholder id="ContentPlaceHolder1"
runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>
 
J

Joe Fawcett

This code works properly in IE ,but fire fox doesn't show the image!!



<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!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>Master Page</title>
<style type="text/css">

</style>
</head>
<body style="margin:0;">

<form id="form1" runat="server">
<div>
<center>
<table style="width:100%; background-color:Black; height:75px;"
cellpadding="0px;" cellspacing="0px">
<tr>
<td >
<asp:Image ID="image1" runat="server" ImageUrl="~/Images/
Banner.jpg" AlternateText="banner"/>
</td>
</tr>
</table>
</center>
<asp:contentplaceholder id="ContentPlaceHolder1"
runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>
What does the actual HTML look like if you use view source in FireFox? Just
show the few lines with the image element if it's a large page.
 
M

Morad

What does the actual HTML look like if you use view source in FireFox? Just
show the few lines with the image element if it's a large page.



Here is the body of the actual HTML:

<body style="margin:0;">

<form name="aspnetForm" method="post" action="default.aspx"
id="aspnetForm">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/
wEPDwULLTEwMDUyNjYzMjhkZDb/t/kquMagf1RBrd1IArHZAeT+" />
</div>

<div>
<center>
<table style="width:100%; background-color:Black; height:75px;"
cellpadding="0px" cellspacing="0px">
<tr>
<td >
<img id="ctl00_image1" src="Images/Banner.jpg" alt="banner"
style="border-width:0px;" />
</td>
</tr>
</table>

</center>

</div>
</form>
</body>
 
J

Joe Fawcett

Here is the body of the actual HTML:
<body style="margin:0;">

<form name="aspnetForm" method="post" action="default.aspx"
id="aspnetForm">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/
wEPDwULLTEwMDUyNjYzMjhkZDb/t/kquMagf1RBrd1IArHZAeT+" />
</div>

<div>
<center>
<table style="width:100%; background-color:Black; height:75px;"
cellpadding="0px" cellspacing="0px">
<tr>
<td >
<img id="ctl00_image1" src="Images/Banner.jpg" alt="banner"
style="border-width:0px;" />
</td>
</tr>
</table>

</center>

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

Seems fine and works for me. Do you have some sort of banner blocking
add-in?
Is this on a public site where I can try it?
 
M

Morad

Seems fine and works for me. Do you have some sort of banner blocking
add-in?
Is this on a public site where I can try it?



I run the website from local host and I think that fire fox blocks
images from local host, but don't know how to solve this problem. do
you have any idea how to solve it?
 
M

Morad

thanks Joe.

I solved the prblem

The problem was that firefox stored the images in the cache. sol i had
to clear the cache before loading the page, in order to view the
image.

I solved this problem by changing the image url randomly, so there
would be no image in the cache which had the same name.

I added this code to the page load event of the master page:


protected void Page_Load(object sender, EventArgs e)
{
Random rand = new Random();
int num = rand.Next();
Banner.ImageUrl = "~Images/Banner.jpg?" +num.ToString();
}


thank you for helping
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top