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

Recommended Answers

All 5 Replies

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.

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

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

Interesting...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.