Strange behavior after Server.Transfer

Joined
Sep 23, 2006
Messages
1
Reaction score
0
Hi,

I am experiencing a behavior I can´t understand while building an ASP.NET 1.1 application.

I have two pages, Web1.aspx and Web2.aspx. On a button click event of Web1.aspx, I do a Server.Transfer to Web2.aspx. All is fine, since I am "passing parameters" among pages on the Context and it all works fine.

But then, on Web2.aspx I have another button, which I want to do certain things (not relevant so won´t describe them), BUT when I click on the button, before the click event handler is reached, the OnInit event is called on Web2.aspx again!!!

The problem is that on the initialization page I need code that depends on the Context from Web1.aspx, and on that second call the Context is lost so the initialization fails. I have also tried to set an attribute on the page to state when initialization is done (so as not to do it again after the first time... not pretty, I know :), but it doesn´t work, it seems like a new Web2.aspx page is being instantiated. Even if I bypass (very ugly, don´t even want to explain how :) the problem on the OnInit method, the handler for the button click on Web2.aspx is never reached!!!

I am pretty sure there is something I am not understanding about the Server.Transfer process. It may, in fact, be pretty basic, since I´m not that experienced with ASP.NET... but I´m going crazy! Any help will be MUCH appreciated.

Thanks,

Juanjo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top