7

Example:

http://foo.com/generatepdf.aspx?u=http://foo.com/somepage.aspx?color=blue&size=15

I added the iis tag because I am guessing it also depends on what server technology you use?

5 Answers 5

3

The server technology shouldn't make a difference.

When you pass a value to a query string you need to url encode the name/value pair. If you want to pass in a value that contains a special character such as a question mark (?) you'll just need to encode that character as %3F. If you then needed to recursively pass another query string to the encoded url, you'll need to double/triple/etc encode the url resulting in the original ? turning into %253F, %25253F, etc.

Sign up to request clarification or add additional context in comments.

Comments

2

you'll probably want to UrlEncode the url that is in the query string.

1 Comment

I've found it's more reliable to Base64 encode the URL. I've run into issues concerning + and spaces being indistinguishable.
1

As reported in http://en.wikipedia.org/wiki/Query_string

W3C recommends that all web servers support semicolon separators in addition to ampersand separators (link reported on that wiki page) to allow application/x-www-form-urlencoded query strings in URLs within HTML documents without having to entity escape ampersands.

So, I suppose the answer to the question is yes and you have to change in a ";" semicolon the "&" ampersand usaully used for key=value separator.

Comments

0

Yes it can, as far as I can tell, according to RFC 3986: Uniform Resource Identifier (URI): Generic Syntax (from year 2005):

This is the BNF for the query string:

query         = *( pchar / "/" / "?" )
pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"

The spec says:

  • The characters slash ("/") and question mark ("?") may represent data within the query component.
  • as query components are often used to carry identifying information in the form of "key=value" pairs and one frequently used value is a reference to another URI, it is sometimes better for usability to avoid percent-encoding those characters

(But I suppose your server framework might or might not follow the specification exactly.)

Comments

-1

No, but you can encode the url and decode it later.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.