1.1 +

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.


try an if notpostback = true then ... whatever code on pageload ... end if

maybe something in your code is causing it to reload?

which could happen if you are setting the value of a control with an autopastback - on setting.


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?


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.
Thanks again,