You are on page 1of 7

Server objects and Query String

Session objectives
 Sending and Receiving key value
pairs using Query string

Kumar S
http://www.guyfromchennai.com
System.Web.HttpServerUtility

Provides helper methods for processing


Web requests

Kumar S
http://www.guyfromchennai.com
Query string
 Query string is used to pass values
from one page to another

 Query String is a set of key value


pairs attached to the URL during the
page request

Kumar S
http://www.guyfromchennai.com
Query string
 This Query string can be retrieved
using Request.QueryString

 In order for query string values to be


available during page processing, you
must submit the page using an HTTP
GET command

Kumar S
http://www.guyfromchennai.com
Example
 Response.Redirect(“Default2.aspx?
name=Raja&age=45”);
Attaching a query string to the end of the Url

 string name=Request.QueryString[“name”];
In Default2.aspx get the value for the name key

 int age=int.Parse(Request.QueryString[“age”]);
In Default2.aspx get the value for the age key

Kumar S
http://www.guyfromchennai.com
Session Summary
 Sending and Receiving key value
pairs using Query string

Kumar S
http://www.guyfromchennai.com

You might also like