| | |
QueryString
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
I use querystring to retrieve parameters send from another form, let's say that you are and index.html and there is a link url to default.aspx like this
~/Default.aspx?var=hello
then and the Server code from Default.aspx to retrieve that value i have this.
now stTest is equal to "hello"
hope that help you
~/Default.aspx?var=hello
then and the Server code from Default.aspx to retrieve that value i have this.
ASP.NET Syntax (Toggle Plain Text)
string stTest = Request.QueryString["var"];
hope that help you
If your already resolved your issue, flag it as solved.
José Bisonó
José Bisonó
Its handy if you want to pass data to other pages, especially when you want it retained in the browser's history. If you POST search terms to google for example then you wouldn't have a list of all searches you performed in your browser history.
•
•
Join Date: Oct 2008
Posts: 103
Reputation:
Solved Threads: 14
It comes from the days of ASP.
The "Request.QueryString" command is used to collect values in a form with method="get".
SimpleForm_1.asp
SimpleFormHandler_1.asp
The "Request.Form" command is used to collect values in a form with method="post".
SimpleForm_2.asp
SimpleFormHandler_2.asp
See http://www.w3schools.com/ASP/asp_inputforms.asp
The "Request.QueryString" command is used to collect values in a form with method="get".
SimpleForm_1.asp
ASP.NET Syntax (Toggle Plain Text)
<form method="get" action="SimpleFormHandler_1.asp"> <TEXTAREA NAME="location" COLS=33 ROWS=4></TEXTAREA> <input type='submit' value='Add Event'> </form>
SimpleFormHandler_1.asp
ASP.NET Syntax (Toggle Plain Text)
<%@ Language=VBScript %> <% Dim userLocation 'location is the variable name as defined by "NAME=" 'in SimpleForm_1.asp userLocation = Request.QueryString("location") %>
The "Request.Form" command is used to collect values in a form with method="post".
SimpleForm_2.asp
ASP.NET Syntax (Toggle Plain Text)
<form method="post" action="SimpleFormHandler_2.asp"> <TEXTAREA NAME="location" COLS=33 ROWS=4></TEXTAREA> <input type='submit' value='Add Event'> </form>
SimpleFormHandler_2.asp
ASP.NET Syntax (Toggle Plain Text)
<%@ Language=VBScript %> <% Dim userLocation 'location is the variable name as defined by "NAME=" 'in SimpleForm_2.asp userLocation = Request.form("location") %>
See http://www.w3schools.com/ASP/asp_inputforms.asp
Last edited by cgeier; Aug 28th, 2009 at 6:57 pm.
•
•
Join Date: Oct 2008
Posts: 103
Reputation:
Solved Threads: 14
You'll probably find more info on it if you search for "ASP Request.QueryString" and "ASP Request.Form".
C#
C#
C#
ASP.NET Syntax (Toggle Plain Text)
string userLocation; userLocation = Request.QueryString["location"];
C#
ASP.NET Syntax (Toggle Plain Text)
string userLocation; userLocation = Request.Form["location"];
•
•
Join Date: Aug 2009
Posts: 17
Reputation:
Solved Threads: 1
Ok, I will flag this thread then.
Ok, so I read all of your comments, and thanks for it
I'm gonna ask another question about this.
I need to get the id=123 in http://www.website.com/something.php?id=123, in my C# application. Whenever I press a new button on the website the C# app needs to get the new id, or
value etc etc. So would this then be the best solution to get it? Or could I better use something else..?
Thanks again,
Davey
Ok, so I read all of your comments, and thanks for it

I'm gonna ask another question about this.
I need to get the id=123 in http://www.website.com/something.php?id=123, in my C# application. Whenever I press a new button on the website the C# app needs to get the new id, or
value etc etc. So would this then be the best solution to get it? Or could I better use something else..?
Thanks again,
Davey
I flagged it for you. The button should be located under the reply:
•
•
•
•
sknake Online
Posting Virtuoso
Re: QueryString #9 1 Minute Ago | Add to sknake's Reputation | Flag Bad Post
Last edited by sknake; Aug 29th, 2009 at 10:38 am.
![]() |
Similar Threads
- how to hide querystring in asp.net2.0 (Python)
- Problem with querystring trimming (VB.NET)
- About querystring (PHP)
- Get querystring (JavaScript / DHTML / AJAX)
- can i retrieve the break tag from querystring? (HTML and CSS)
- Help with Querystring error (PHP)
- Requesting Querystring (ASP)
Other Threads in the ASP.NET Forum
- Previous Thread: Lock Window
- Next Thread: i want to write the byte[] array into a file
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions compatible content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv gridview gudi iis javascript list listbox login menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order panelmasterpagebuttoncontrols problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 ssl tracking treeview validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers






