Page_Load fires twice with Mozilla

G

Guest

Has anyone seen this one? I have a situation where code in my page_load event
is firing twice for mozilla firefox users. Everything is fine in IE6. I set
breakpoints and verified.
The second time the page_load fires in mozilla, I checked the IsPostback to
verify that it is still false.
What causes this behavior?
Thanks,
Ed
 
K

Kumar Reddi

Hi Ed,
check to see if you have AutoEventWireup set to true in the Page
directive

Kumar
 
G

Greg Johnson

Hi,
I currently have it set to false.

Thanks,
Ed

I'm seeing the same thing. I have AutoEventWireup also set to false,
yet I see Page_Init and Page_Load getting called twice in Firefox. In
IE, it only gets called once. A bug in Firefox?
 
G

Guest

Actually, I found the answer to my own problem. It occured for me in the
html. We had an external javascript file included in the control we used for
the page header. Under certain situations, it would be written out as double
quotes without the file name. That caused the page to load twice. I assure
you that was not an easy find.

I have heard other instances of similiar problems with malformed html or css.

Hope that helps.
 
Joined
Jun 3, 2009
Messages
1
Reaction score
0
Other reasons

I've read that everything matters to firefox. For example closing css lines with ";" even though it displayed correctly. Also colors start with #.
In my case my asp.net pages contained asp:image controls where imageurl property was not present at all. After I added it only postback happens. -Tool a while to get this right also. Both Safari and Crome worked fine even without it.
 
Joined
Sep 2, 2009
Messages
2
Reaction score
0
Firefox will reload the page automatically, if

1) There is atleast one blank link to a style sheet like

<Link href="" rel="stylesheet">

2) Blank script reference

<script src="" language="javascript/>

3) Broken important html tags, like <img> without </img> or empty source attributes for image, or background color

4) missing ";" after a css class statement like

.href
{
color:black
}

(there should be semicolon after black, and a "." before the class name href)

... and so on.

Be careful when you code html, in Firefox. A small mistake can cause it to behave wierdly. FF will distort styles, if you dont specify the parmaeters properly, or there is insufficient space to draw. Also, it will load the page twice, silently if there are any errors (like mentioned above)... and this can cause your application to behave wierdly.
 
Joined
Jun 11, 2009
Messages
9
Reaction score
0
I am aware of following two things.

If you have img control with empty string assigned to src attribute.
<img src=””/>
<asp:image runat=”server” id=”img”/>
You may be forgot to assign imageurl or wanted to assign imageurl in code behind based on the some condition and that condition never gets executed and ended up being empty string assigned to src attribute when ASP.Net renders the page.

If you have empty string assigned to href attribute to html link for stylsheet.
<link rel=”stylesheet” href=””/>

If you have empty src attribute set to script.
<script src=”” type=”text/javascript”>

for more information you can read my post.
patelshailesh.com/index.php/page_load-event-fires-twice-with-firefox-only
 

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,774
Messages
2,569,599
Members
45,166
Latest member
DollyBff32
Top