Hi friend, here i have explained about QueryString.
Introduction:
QueryString is used
to pass the variables content between
your HTML page or aspx webform context in asp.net. For Example if you collect
the information like user_name and id and
you want to pass these value to another page.For this you can use QueryString.
Exmple :
you want to show like
this
http:/www.yourdomainname.com/default.aspx?username=Rahul&id=10023
for this you can write the code given below:
private
void
btnGO_Click(
object
sender,
System.EventArgs e)
{
Response.Redirect(“
Default.aspx?username=”
+txt_username.Text
+”&id=”
+txt_id.Text);
}
If you want to
retrieve these value to another page
write the code given below
private
void
Page_Load(
object
sender,System.EventArgs
e)
{
txt_name.Text=Request.QueryString[
"username"];
Txt_id.Text=Request.QueryString[
"id"];
}
Advantage:
It is easy to write.
Limitations:
1.)It have a max length.If you have to send a lot
information this approach doesn’t work.
2.)It is visible in your address part of your browser so you
cant use it with the sensitive information.
3.)It can not be used to send & and space.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.