473,396 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Page_Unload gets executed twice

Well, the subject describes my problem quite well :-) Here is some
additional information.

I use a common base class for all the pages in my project. It is
derived from Page and it is not abstract, because there was some
problem with the compilation. I define a common Page_Unload handler in
the base class and subscribe for the event like this:

public class IPage : System.Web.UI.Page
{
override protected void OnInit(EventArgs e)
{
/* ... */
base.OnInit(e);
this.PreRender += new EventHandler(IPage_PreRender);
this.Load += new EventHandler(IPage_Load);
this.Unload += new EventHandler(IPage_Unload);
}

protected virtual void IPage_Unload(object sender, EventArgs e)
{
if ( IsPostBack )
{
/* ... */
}
}
}
In the derived class unload is not mentioned at all. The first time the
page is loaded IPage_Unload gets executed once. When I click a submit
button the page is posted back to the server, the Page_Load event is
fired, then the button click handler, Page_Unload follows and finally,
gues what... Page_Unload again. Any idea why is this happening? This
is not happening for every page in the project, only for a particular
one and maybe some others. There is little delay between the two
successive Page_Unload executions, less than between Page_Load and
Page_Unload. Any suggestions?

Thanks all

Nov 19 '05 #1
0 1399

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

Similar topics

0
by: tascien | last post by:
I found a use for Page_Unload event method... here is the scenario: 1. Page.aspx has DoStuff.ascx in it. 2. DoStuff.ascx has a button that updates child control label lbXml depending on user...
3
by: James Hawthorne | last post by:
Hi, I have created a asp.net web application and I hooked up page_unload so I can clean up some things when i close it down. The problem is, page_unload gets called when I first load the page, not...
1
by: Robert Scheer | last post by:
Hi. Debugging one of my pages I noticed that everytime I call the page, the first event to run is Page_Load and after it the Page_Unload. If I postback to the page the Page_Unload runs again....
4
by: Larry Morris | last post by:
The following code, pasted into a web form with a link button on it, will cause the page_unload event to fire twice. If I remove the response.redirect, the problem goes away :). I've got a work...
3
by: vvenk | last post by:
Hello: I was trying to destroy objects in the Page_Unload event. That's when I see that the Page_Unload event gets triggered when I load a page, right after it completes page_load event! Why?...
0
by: JeffM | last post by:
This seems odd, but it appears that the Page_Unload event is fired twice on a Response.Redirect or a Server.Transfer. The output below demonstrates that during the move from the first to the 2nd...
7
by: Cenk | last post by:
Hi, After converting my projects to ASP.Net 2.0 I have seen a problem with Page_unload. Ä°n framework 1.1 page_unload event fires when you are leaving the page or has closed the browser window....
0
by: Stina | last post by:
I have a problem with the Page_Unload event being called twice in a row on a redirect and I just can't figure out why. I have seen other threads on this subject but not found a solution to the...
2
by: Dan Lichiardopol | last post by:
Hi there! I'm trying to use page unload event in order to write info to a text file. Everything works fine, unless code contains a call to Response.End. Then, the unload event appears to be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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...

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.