我从解决方案中的一个项目向另一个项目发送请求:
WebRequest request = WebRequest.Create(UrlTemplate);
request.Timeout = 500000;
request.Method = WebRequestMethods.Http.Post;
request.ContentType = ContentType;
byte[] postData = System.Text.Encoding.ASCII.GetBytes(data);
request.ContentLength = postData.Length;
Stream newStream = request.GetRequestStream();
// Send the data.
newStream.Write(postData, 0, postData.Length);
newStream.Flush();
newStream.Close();
在设置了
UrlTemplate
的函数中,我得到了正确的字符串(我将其发送到数据中),但问题在于当字符串包含特殊字符时。如果字符串是:
12&34
我在函数中得到的是:12
。如果字符串是:
12+34
我在函数中得到的是:12 34
。我很乐意知道是否有人遇到过这种情况以及如何解决。提前感谢您。