Querystring Issue on C# with special characters

asp.net, c#, query-string

Solution

A plus sign in a query string translates to a space. If you want an actual plus sign rather than a space, use `%2B` instead.

/default.aspx?search=test%2B%2B

If you're doing this in code, then you should be using `UrlEncode` to encode this portion of the query string.

Problem

I came across a very weird issue where in my querystirng had "++" as part of the text. but when i assign the query stirng value to a string ++ will become two spaces. How do i get exactly what is being passed as querystring? I observed that the querystirng collection had "++" but when I do Request.QueryString["search"].ToString() "++" gone, I checked in Immediate window. I use C# 2.0 URL: /default.aspx?search=test++ ``` string t = Request.QueryString["search"].ToString(); ```

Original source