---
title: "How We Create Query String in Asp.net"  
description: "The Use of query string in web application  We pass the value from one page to another page by query string, we write the syntax as1) Response.Redirec"  
author: "Amit Singh"  
published: 2010-10-25  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/28/how-we-create-query-string-in-asp-dot-net  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# How We Create Query String in Asp.net

The Use of [query string](https://www.mindstick.com/articles/512/query-string-in-asp-dot-net) in [web application](https://www.mindstick.com/articles/13069/progressive-web-application-pwas-all-you-need-to-know-about)\
We pass the [value from one](https://www.mindstick.com/forum/378/how-to-pass-value-from-one-controller-to-another-controller) [page to another page](https://www.mindstick.com/forum/118/problem-in-display-content-of-one-page-to-another-page) by query string, we write the syntax as

##### 1) Response.Redirect("Default.aspx?query=John Smith");

where "query" is query string [variable](https://www.mindstick.com/articles/1807/objective-c-data-types-variables-object-creation) and "John Smith" is the [string value](https://www.mindstick.com/forum/159623/how-to-get-an-enum-value-from-a-string-value-in-c-sharp) for query variable.Now we access the value on Default.aspx page as \
string query=Request.QueryString["query"].toString(); \
2) we pass the [multiple](https://www.mindstick.com/blog/12797/iowa-is-expected-to-see-heavy-growth-in-multiple-sectors) [parameter](https://www.mindstick.com/blog/450/parameter-class-in-c-sharp) by query string then we write the syntax as \
Response.Redirect("Default.aspx?query1=John Smith &query2=krish"); \
Now we access the value on Default.aspx page as \
string query1=Request.QueryString["query1"].toString();string query2=Request.QueryString["query2"].toString(); \
or string query1=Request.QueryString[0].toString();string query2=Request.QueryString[1].toString(); \
or string query1=Request.Params[0].toString();string query2=Request.Params[1].toString(); \
3) We pass the any value by query string as \
string str="JohnSmith";Response.Redirect("Default.aspx?query="+str); \
And access these value on another page by \
string query=Request.QueryString["query"].toString(); **\**

##### Advantage of query string

it is easy to create for [passing data](https://www.mindstick.com/interview/34053/passing-data-into-components-in-knockout) from one page to another

##### Disadvantage

It is visible in urlIt contains high lenth data so it is not support to sending more data

---

Original Source: https://www.mindstick.com/blog/28/how-we-create-query-string-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
