Re: Server.Transfer or Server.Execute vs WebClient

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Did you try this with the additional attribute which preserves the context
and form variables on transfer ?

--
Terry Burns
http://TrainingOn.net
"ewolfman" <ewolfman@xxxxxxxxx> wrote in message
news:1139774236.499868.194130@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi Terry,

As I've written, Server.Transfer or Server.Execute - it doesn't matter.
Server.Transfer calls Server.Execute, but simply doesn't return the
control's execution.

So this isn't the answer.

However, I did manage to find the problem. The loading process of the
Page determines on how to load the page, using the IsPostback property.
The IsPostback property for a Server.Transfer returns false (in
contrast to the WebClient.UploadValues), because the context's handler
isn't the same as the target page, and the ServerExecuteDepth is
greater than 0 (in contrast to the WebClient effect).

Therefore - the following 2 lines (before calling the Server.Transfer)
- seem to have solved the problem:

type = Type.GetType("ASP.default_aspx");
HttpContext.Current.Handler =
(IHttpHandler)Activator.CreateInstance(type);

Thanks anyway.



.