c# - why Request.QueryString replace + with empty char in some cases? -
I have a problem that if I pass a string in which +
is in a query string And try to read it, it gets a single string, but with the empty letter + by changing For example if i ../ Page.aspx? Data query = sdf1 + sdf
, then in the page load, the data by
data = request. Is being read. JQuery String ["Data"]
will find it as below data = "sdf1 sdf"
I resolved any empty letter +
..
There is a problem by changing, but is there any such problem which is the reason? And what's the solution with the empty characters + in all cases?
Because +
url is represented by encoded location ""
. If you want to undo Plus Plus in your value, then you have to encrypt the URL:
"/ Page.aspx? Data =" + HttpUtility.UrlEncode ("sdf1 + sdf" )
which will generate:
/ page.aspx? Data = sdf1% 2bsdf
Now when you Read requests.cotstrings ["data"]
will receive what you expect.
Comments
Post a Comment