Blog
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    APIs
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog
Report Abuse Form
Reason:    
 

Home >> ASP.Net & Web Forms >> How we create query string in asp.net
How we create query string in asp.net

query string is used for passing data from one page to another page.
Views: 2617     Comments: 0
by Amit Singh on 10/25/2010
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 as

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

where "query" is query string variable and "John Smith" is the string value for query variable.
Now we access the value on Default.aspx page as

string query=Request.QueryString["query"].toString();

2) we pass the multiple parameter 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 from one page to another

Disadvantage

It is visible in url
It contains high lenth data so it is not support to sending more data
Title :  
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
       
 
Report Abuse Form
Reason:    
 
Latest ArticleRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest Blogs by Amit SinghRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 2937
  
Copyright © 2009 - 2013MindStick. All Rights Reserved.