asp.net C# Request.QueryString[“sms”] +符号
我的客户端有 2 个服务器,然后从第一个服务器想要发送带有一些参数的请求,第二个服务器使用 get 方法获取这些参数,问题是当请求到来时,其中有一个 + 符号,例如在血型中为 A+ ,B+,O+
数据正常,但是当我插入记录时,它会从中删除 + 符号。
我怎样才能完成它,因为它们之间有一些空间。
获取方法
http://domain.com/join.aspx?msid=238487987328&短信=彼得 D 23 O+ 印第安纳
当我使用 Request.QueryString["sms"] 获取它时,它删除了 + 符号
谢谢 问候
my client have 2 server and from first server then want to send a request with some parameters and the second server take those parameters with get method, the problem is when the request come there is a + sign in it for e.g in blood group its A+, B+, O+
The data is coming fine but when I am inserting the record its removing + sign from it.
how can I get it done, as there is some space between them.
get method
http://domain.com/join.aspx?msid=238487987328&sms=Peter
D 23 O+ Indiana
when I am getting it with Request.QueryString["sms"] its removing + sign
Thanks
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要对参数进行 URL 编码(或相反,整个 URL)。
You need to URL encode the parameters (or rather, the whole URL).
+
符号是空格的编码版本,因此需要 URL 编码 来保留它。事实上,您需要对任何 URL 传递的参数进行 URL Encode,记下以备将来!
The
+
sign is the encoded version of a space, and therefore need URL Encoding to preserve it.In fact, you need to URL Encode any URL passed parameters, make a note for the future!
对
+
符号进行编码,然后将其添加到您的查询字符串中Encode
+
sign then add it to your query string