Total Page Preview:   000000000249

What is query string in ASP.NET in English and Hindi



Query string in ASP.NET in English

In ASP.NET, a query string is a part of a URL that contains data that is passed to a web page as parameters. Query strings are commonly used to pass data between different pages of a web application.

Here's an example of a query string in ASP.NET using C#:
Suppose you have a web page called "MyPage.aspx" and you want to pass two parameters, "name" and "age", to this page. You can construct a URL with the query string as follows:
In this example, the URL includes the parameters "name" and "age", along with their values "John" and "30", respectively.
On the "MyPage.aspx" page, you can retrieve the values of these parameters using the Request.QueryString property in the Page_Load method:
In this code, we are retrieving the values of the "name" and "age" parameters using the Request.QueryString property and then assigning them to local variables. Note that we are parsing the value of the "age" parameter as an integer using the int.Parse method.
After retrieving the values of the query string parameters, you can use them in your page as needed.
Query string in ASP.NET in Hindi
ASP.NET mai query string ek aisa URL ka hissa hota hai jis mein data parameters ki sorat mein web page tak pohanchaya jata hai. Query strings aam tor par web application ke alag-alag pages ke darmiyan data pohanchane ke liye istemal kiye jate hain.
Yahan ek ASP.NET aur C# ke example ke sath query string ka istemal bataya gaya hai:
Maan lijiye aapke paas "MyPage.aspx" naam ka ek web page hai aur aap is page tak do parameters "name" aur "age" pohanchana chahte hain. Aap query string ke saath ek URL is tarah se banate hain:

Is example mein, URL mein "name" aur "age" ke parameters shamil hain, sath hi unke values "John" aur "30" hain.
"MyPage.aspx" page par, aap Page_Load method mein Request.QueryString property ka istemal karke in parameters ki values ko retrieve kar sakte hain:
Is code mein, hum "name" aur "age" ke parameters ki values Request.QueryString property ka istemal karke retrieve kar rahe hain aur unhein local variables mein assign kar rahe hain. "age" parameter ki value ko hum int.Parse method ka istemal karke integer mein parse kar rahe hain.
Query string parameters ki values retrieve karne ke baad, aap unhein apne page mein zaroorat ke mutabiq istemal kar sakte hain.


Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn :





Facebook User: