Server.Transfer with params???

  • Thread starter Thread starter ndario
  • Start date Start date
N

ndario

i am trying to transfer a user to another page with Server.Transfer()
but i am having a problem with sending query params like this

Server.Transfer("newPage.aspx?param=value");

in the PageLoad method of the newPage.aspx.cs,
Request.QueryString["param"] is allways null. is there any way to
transfer to another page, but to recive a param on the another page. i
even try with response.redirect, but it doesn't help. also, puting
value in the session wasn't visible in the newPage.

am i doing something wrong?
 
ndario,

you have to use response.redirect when sending values in querystring

/Lasse
 
Server.Transfer transfers control of the current thread to another Page
class. It is not the same as Response.Redirect. where a header is sent to
the client instructing it to request a different URL. It is a server-side
invocation of another Page class, via it's location. In other words, you can
use a QueryString to pass data to the next Page.

HOWEVER, the current HttpContext is passed to the new Page class along with
the thread of execution. So, you can put any data you want into the Context
object prior to tranferring control, and it will be available to the called
Page class.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top