473,604 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page_Load event fires twice in asp.net (C#) ?

Jon
Hi,

I've set up a new web form (new.aspx) that inherits a BasePage class.
The new web form contains an override Page_Load event. In BasePage,
Page_Load is declared 'virtual'. In the new web form, base.Page_Load
is called from within its Page_Load method so that both Page_Load
methods are executed.

AutoEventWireup is set to False, yet the page load and all following
code on the new web form is called twice. What am I doing wrong here?

Regards
Jon
Nov 18 '05 #1
1 4012
I had that problem before.

Here is scenario.

My page had an url http://www.mysite.com/page.aspx/param1
where param1 is the parameter
So when i had the image on the page <img src="img/my.gif"> browser will make
a second request for
http://www.mysite.com/page.aspx/img/my.gif
So Page_Load will execute twice.

I spent 3 hours to figuring out that problem :)

George.

"Jon" <to****@hotmail .com> wrote in message
news:e4******** *************** **@posting.goog le.com...
Hi,

I've set up a new web form (new.aspx) that inherits a BasePage class.
The new web form contains an override Page_Load event. In BasePage,
Page_Load is declared 'virtual'. In the new web form, base.Page_Load
is called from within its Page_Load method so that both Page_Load
methods are executed.

AutoEventWireup is set to False, yet the page load and all following
code on the new web form is called twice. What am I doing wrong here?

Regards
Jon

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1444
by: Gary | last post by:
When attempting to write a PDF stream to the web browser, the Page_Load event fires twice if a user has Internet Explorer configured to 'Check for newer versions of stored pages: Every visit to the page'. This is causing me tremendous grief. Here's an abstract of code to prove the problem. New FirstReport() is a blank report. Can someone please tell me how to stop this behaviour? Thanks Greatly
0
1171
by: H Branyan | last post by:
I have a user control and its Page_Load event is firing twice. I have consulted articles such as this one: http://www.extremeexperts.com/Net/FAQ/PageLoadFiringTwice.aspx This article essentially says that if I set AutoEventWireUp to false, then the Page_Load will only fire once. However, that is not the right solution for me. Here is my code: in the .ascx.cs file:
7
2095
by: Jay Douglas | last post by:
Hello all, I have a asp.net page that creates a pdf on the fly and sends the pdf down to the browser. When calling the page up in IE the Page_Load event is fried twice. This doesn't happen with mozilla, just IE. This is a big problem because the PDF can be 20+ MB in size and is causing some serious performance issues. Writing the PDF to the filesystem then a redirect is not an option. I was wondering if anybody has any input on how...
4
1709
by: Ed | last post by:
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
14
13103
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) { //existing session? if (Session == null) { //save local empty order object this._newOrder = Orders.Initialize();
3
2423
by: doobdave | last post by:
Hi all, I'm experiencing a rather strange problem: I am coding a web application using VB.net ASP.net and Visual Studio 2003. It's quite a large application, but the problem only occurs on one of the Web User Controls. This particular Web User Control has some text entry fields in it,
4
3965
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques was endeavoring to create a custom user control to make things a bit simpler, but she noticed that her Page_Load eventhandler was firing twice. So after long hours of research and experimentation, I stumbled upon, imho, is quite the discovery. ...
0
1927
by: pat.allan | last post by:
Hi All This seems to be a common problem here, but I've not found a solution yet to fix it for me. When I request a page through a browser, the page_load fires once. When I request the page's code-behind object via a custom handler and the code-behind object's ProcessRequest method, it fires twice - both times from the ProcessRequest call, as far as I can tell.
1
1830
by: =?Utf-8?B?TWlrZXkgQmFieQ==?= | last post by:
Greetings Hopefully, I can be clear and concise on this one, but I'm confused. I have a page with a ListBox <- ODS <- BusinessObject and a button. The Parameter Source is 'None'. The Default Value is left blank. Both are set in the Page_Load (myODS.SelectParameters.DefaultValue = 999) I put Debug statements in the Page_Load, ODS_Load and method of my
0
7929
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8409
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8065
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8280
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5882
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3955
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.