I have a code example like this :
location.href = location.href + "/Edit?pID=" + hTable.getObj().ID; ; //aspx parID = Request.QueryString["pID"]; //c#
it works, my question is – how ? what is the logic ?
thanks 🙂
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
The HttpRequest class represents the request made to the server and has various properties associated with it, such as QueryString.
The ASP.NET run-time parses a request to the server and populates this information for you.
Read HttpRequest Properties for a list of all the potential properties that get populated on you behalf by ASP.NET.
Note: not all properties will be populated, for instance if your request has no query string, then the QueryString will be null/empty. So you should check to see if what you expect to be in the query string is actually there before using it like this:
if (!String.IsNullOrEmpty(Request.QueryString["pID"]))
{
// Query string value is there so now use it
int thePID = Convert.ToInt32(Request.QueryString["pID"]);
}
Method 2
A query string is an array of parameters sent to a web page.
This url: http://page.asp?x=1&y=hello Request.QueryString[0] is the same as Request.QueryString["x"] and holds a string value "1" Request.QueryString[1] is the same as Request.QueryString["y"] and holds a string value "hello"
Method 3
The Request object is the entire request sent out to some server. This object comes with a QueryString dictionary that is everything after ‘?’ in the URL.
Not sure exactly what you were looking for in an answer, but check out http://en.wikipedia.org/wiki/Query_string
Method 4
Request.QueryString["pID"];
Here Request is a object that retrieves the values that the client browser passed to the server during an HTTP request and QueryString is a collection is used to retrieve the variable values in the HTTP query string.
READ [email protected]
http://msdn.microsoft.com/en-us/library/ms524784(v=vs.90).aspx
Method 5
The QueryString collection is used to retrieve the variable values in the HTTP query string.
The HTTP query string is specified by the values following the question mark (?), like this:
Link with a query string
The line above generates a variable named txt with the value “this is a query string test”.
Query strings are also generated by form submission, or by a user typing a query into the address bar of the browser.
And see this sample : http://www.codeproject.com/Articles/5876/Passing-variables-between-pages-using-QueryString
refer this : http://www.dotnetperls.com/querystring
you can collect More details in google .
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0