I have a ashx handler in asp.net webform (.net 3.5) application in which i have to initialize some object with form field data. One of a field is "To" is a telephone field having data like To=+1852931591 Problem is that when I am filling it into object by simply context.Request.Form["To"] it is removing + sign. I have even tried htmlencode/decode but nothing work.
My code is like
var listValues = new Dictionary<string, string>();
foreach (string key in context.Request.Form.AllKeys.Where(k => !String.IsNullOrEmpty(k)))
{
listValues.Add(key, context.Request.Form[key]);
}
+
is a way of indicating spaces in URLs. That value will be interpreted as [space]1852931591
.
If you want to have a plus sign in a query value, you'll need to encode it as %2B
or preferably encode all of your query values with something like encodeURIComponent()
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.