Response.Redirect question

J

Jason Huang

Hi,

In the Form1.aspx, I have
Response.Redirect("Form2.aspx?lblUserName=" + "John");
However, in the browser, when I go to the Form2 via Form1's
Response.Redirect, I don't find the John in the label lblUserName.
Would someone tell me what have I done wrong with it?
Thanks for help.


Jason
 
V

Vadym Stetsyak

Hello, Jason!

Response.Redirect("Form2.aspx?lblUserName=" + "John");

means that Form2.aspx request's querÕ parameter will contain value "Jonh"
under key "lblUserName"

In the other words Form2.aspx this.Request["lblUserName"] will be equal to
"Jonh"

You wrote on Fri, 8 Jun 2007 14:59:27 +0800:

JH> Hi,

JH> In the Form1.aspx, I have
JH> Response.Redirect("Form2.aspx?lblUserName=" + "John");
JH> However, in the browser, when I go to the Form2 via Form1's
JH> Response.Redirect, I don't find the John in the label lblUserName.
JH> Would someone tell me what have I done wrong with it?
JH> Thanks for help.


JH> Jason



With best regards, Vadym Stetsyak.
Blog: http://vadmyst.blogspot.com
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Jason said:
Hi,

In the Form1.aspx, I have
Response.Redirect("Form2.aspx?lblUserName=" + "John");
However, in the browser, when I go to the Form2 via Form1's
Response.Redirect, I don't find the John in the label lblUserName.
Would someone tell me what have I done wrong with it?
Thanks for help.

What you have done wrong is to expect some functionality that simply
does not exist.

There is no connection between the querystring and the controls on the
page. That would be a security risk, as anyone would be able to change
the content of any control on the page, even a password field.

You use the Request.QueryString collection to get the values from the
querystring. Request.QueryString["lblUserName"] will contain the value.
 
M

Mr. Arnold

Jason Huang said:
Hi,

In the Form1.aspx, I have
Response.Redirect("Form2.aspx?lblUserName=" + "John");
However, in the browser, when I go to the Form2 via Form1's
Response.Redirect, I don't find the John in the label lblUserName.
Would someone tell me what have I done wrong with it?
Thanks for help.

All you did was pass a parameter value back to Form2 with the of
lblUserName. the parm could have been called John.

In order to get the parm lblUserName or John value of *John* you have to use
the QueryString statement in Form2 to set lblUserName.Text =
Request.QueryString["lblUserName"]

You may want to look-up Request.Form too.
 

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

Similar Threads


Top