0

I have a situation where the user is able to enter any characters they want in a URL query string.

Example:

http://localhost/default.aspx?ID=a‡jljglkjg

How can I accept special characters such as ‡, ˆ, and † in asp.net from a URL query string? I am finding that when I attempt to retrieve these URL query string these special characters gets replaced with a “?”.

Note: The user inputs these query string into the URL.

2
  • why not make UrlEncode ? is this not permitted ? And second, how you try to retrieve this characters - with what function ? Commented Jul 20, 2011 at 20:38
  • I am using Request.QueryString to retrieve these characters. Commented Jul 20, 2011 at 20:40

3 Answers 3

1

This URL is wrong according to RFC.

  • If they are using browser, it would normally do the ecndoing required.
  • If it is done by JavaScript, use encodeURIcomponent
  • If it is a C# app, using HttpUtility.UrlEncode here
Sign up to request clarification or add additional context in comments.

5 Comments

How is it possible that classic ASP can process this request correctly but not asp.net?
Also caret(^) is a valid request but that also gets replaced with a question mark. Why is that?
ASP can since it probably cleans it up before processing. With ^ I think gets confused.
In the case of asp.net then is it possible to clean it up before processing as well or solve this problem somehow?
It could be. Have a look at URL-Rewrite.
0

URLs can only be sent over the Internet using the ASCII character-set.

Those characters will always be excluded, you need to find another way to do it.

1 Comment

I have a legacy application using classic ASP which is able to correctly take in this query string and display it back out again.
0

See http://www.w3schools.com/tags/ref_urlencode.asp for more information about valid URLs and encoding special characters.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.