How to encode a query string so that it is the value of another query string in javascript?

I have a javascript function which passes as a query string value another query string. In other words, I want the query string to be: http://www.somesite.com/?somequery=%3fkey%3dvalue1%2520%26%2520key2%3value3 However, if I redirect like this: var url = ‘http://www.somesite.com/?somequery=’; url += escape(‘?key=value1&key2=value2’); window.location = url; it ends up as http://www.somesite.com?somequery=?key1=value1&key2=value2 in firefox and IE7 which means that I … Read more

Is there a way to get all the querystring name/value pairs into a collection?

Is there a way to get all the querystring name/value pairs into a collection? I’m looking for a built in way in .net, if not I can just split on the & and load a collection. Answer Yes, use the HttpRequest.QueryString collection: Gets the collection of HTTP query string variables. You can use it like … Read more

Semicolon as URL query separator

Although it is strongly recommended (W3C source, via Wikipedia) for web servers to support semicolon as a separator of URL query items (in addition to ampersand), it does not seem to be generally followed. For example, compare         http://www.google.com/search?q=nemo&oe=utf-8         http://www.google.com/search?q=nemo;oe=utf-8 results. (In the latter case, semicolon is, or was at the time of writing this text, … Read more

Request string without GET arguments [duplicate]

This question already has answers here: How to remove the querystring and get only the url? (15 answers) Closed 2 years ago. Is there a simple way to get the requested file or directory without the GET arguments? For example, if the URL is http://example.com/directory/file.php?paramater=value I would like to return just http://example.com/directory/file.php. I was surprised … Read more

Objective-C: How to add query parameter to NSURL?

Let’s say I have an NSURL? Whether or not it already has an empty query string, how do I add one or more parameters to the query of the NSURL? I.e., does anyone know of an implementation of this function? – (NSURL *)URLByAppendingQueryString:(NSString *)queryString So that it satisfies this NSURL+AdditionsSpec.h file: #import “NSURL+Additions.h” #import “Kiwi.h” … Read more

What characters must be escaped in an HTTP query string?

This question concerns the characters in the query string portion of the URL, which appear after the ? mark character. Per Wikipedia, certain characters are left as is and others are encoded (usually with a % escape sequence). I’ve been trying to track this down to actual specifications, so that I understand the justification behind … Read more