Welcome to W3Courses
 Like Us on Facebook

Obtain Values of Query String using C#

You can pass variables via query string from one page to another. The page it is passed to should then recieve that varibale and to use it.

Following is an example on how to pass the variable.


The following code placed in example.aspx will obtain the value of firstname. You should include the following code in the Page_Load function


 string strfirstname;

 if(Request.Params["firstname"] != null)
       strfirstname = Request.QueryString["firstname"]; 
       txtFirstName.Text = Request.QueryString["firstname"];