Send and receive QueryString values in Asp.Net

Querystring is used to transfer information from one page to another. It is the most commonly used way to transfer information between pages. Let’s see how we can send and receive QueryString in ASP.NET.

Sending QueryString

Response.Redirect("Home.aspx?UserId=110");

Receiving QueryString

int UserID = 0;
if (Request.QueryString["UserId"] != null)
{
  int.TryParse(Request.QueryString["UserId"], out UserID);

}

Comments