Context.Items lost using Server.Transfer

  • Thread starter Thread starter LJ Jurkovic
  • Start date Start date
L

LJ Jurkovic

Has anybody encountered a situation like this: Inside Page1.aspx I'm
using Server.Transfer("Page2.aspx") to get to Page2.aspx. I save few
values in Context.Items which I try to restore in Page2. Most of the
time everything works fine, but from time to time the Context items
are completely lost by the time they get to Page2. It happens only in
production so my abilities to debug this are very limited. Are there
any known circumstances that this can occur?

Any help is greatly appreciated,
L.J.
 
Your answer lies in the overloaded methods of the Server object's Transfer
method.
Two of them if I recall; the solution lies in using the other one.
 
Thanks for the reply.
There is and overload to Server.Transfer where you can pass the second
parameter which is bool preserveForm. The documentation states that
passing false would clear Form and QueryString collections. This is the
default value if you omit the second parameter. I guess I can use
preserveForm=true, but I don't see how's that relevant to the
Context.Items collections. Context object is supposed to live only
during the execution of current request. Am I missing something?
 
Back
Top