| | |
Problem - Multiple executions of Page_Load on 1st entry
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2007
Posts: 23
Reputation:
Solved Threads: 0
asp.net 1.1 + vb.net
I am redirecting to a page with a querystring. The system processes the logic of the page_load sub, hits the end sub, then begins the logic again. It does this only once on first entering the page.
When I debug, I can see this activity... when it hits the end sub the second time, it says it can't find logic to execute, and goes into the disassembly trace.
Also, during debug, it says it can't report the value of session variables.
I've tried: deleting the dll and pdb files, exiting the IDE, building/rebuilding, removing all but one line of the sub. Nothing seems to work.
This does not happen with other pages.
Any ideas would be welcome.
Randy
I am redirecting to a page with a querystring. The system processes the logic of the page_load sub, hits the end sub, then begins the logic again. It does this only once on first entering the page.
When I debug, I can see this activity... when it hits the end sub the second time, it says it can't find logic to execute, and goes into the disassembly trace.
Also, during debug, it says it can't report the value of session variables.
I've tried: deleting the dll and pdb files, exiting the IDE, building/rebuilding, removing all but one line of the sub. Nothing seems to work.
This does not happen with other pages.
Any ideas would be welcome.
Randy
•
•
Join Date: Sep 2007
Posts: 23
Reputation:
Solved Threads: 0
ericstenson,
Thanks for the quick reply. When I made the "if not is postback then exit sub" as the 1st lines of the sub, it still executed exactly twice, followed by executing the page_unload sub twice???
There were no autopostback items in the page.
However, I noticed that autoeventwireup for the page was set to true ( a change I had made for other reasons). When I changed that to false, it started working correctly again... any idea why?
Randy
Thanks for the quick reply. When I made the "if not is postback then exit sub" as the 1st lines of the sub, it still executed exactly twice, followed by executing the page_unload sub twice???
There were no autopostback items in the page.
However, I noticed that autoeventwireup for the page was set to true ( a change I had made for other reasons). When I changed that to false, it started working correctly again... any idea why?
Randy
•
•
Join Date: Sep 2007
Posts: 23
Reputation:
Solved Threads: 0
OK, I just looked this up on a search.... here's what I found...
When you explicitly set AutoEventWireup to TRUE, Visual Studio .NET or Visual Studio 2005, by default, generates code to bind events to their event-handler methods. At the same time, the ASP.NET page framework automatically calls the event-handler methods based on their predefined names. This can lead to the same event-handler method being called two times when the page runs. Therefore, Microsoft recommends that you always set AutoEventWireup to FALSE while working in Visual Studio .NET.
http://support.microsoft.com/kb/814745
Thanks again,
Randy
When you explicitly set AutoEventWireup to TRUE, Visual Studio .NET or Visual Studio 2005, by default, generates code to bind events to their event-handler methods. At the same time, the ASP.NET page framework automatically calls the event-handler methods based on their predefined names. This can lead to the same event-handler method being called two times when the page runs. Therefore, Microsoft recommends that you always set AutoEventWireup to FALSE while working in Visual Studio .NET.
http://support.microsoft.com/kb/814745
Thanks again,
Randy
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: total amount
- Next Thread: wat type of cvsnt should be used for asp.net
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 ajax appliances application asp asp.net beginner box browser businesslogiclayer button c# cac checkbox child class compatible content contenttype control countryselector courier database datagrid datagridview datalist deployment development dgv dialog dropdown dropdownmenu dynamic dynamically edit embeddingactivexcontrol feedback fileuploader fill findcontrol flash flv folder form gridview gudi iis image javascript list maps menu mobile mssql nameisnotdeclared news novell opera order parent problem radio ratings redirect refer registration relationaldatabases reportemail richtextbox search security select serializesmo.table sessionvariables silverlight smoobjects software sql sql-server ssl tracking treeview typeof validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming wizard xsl





