【发布时间】:2016-02-25 14:10:45
【问题描述】:
我已使用逗号分隔值进行了发布请求。但是我的表单内容发生了变化,并且“,”替换为“%2C”。所以请求不会在服务器端收到。
我只想将“%2C”替换为“,”。
我尝试了不同的代码,但该代码用于字符串。
//Uri.EscapeDataString(formContent).Replace("%2C", ",");
上面一行是字符串,但我需要同样的 FormContent。
这是我的代码。
Windows.Web.Http.HttpClient clientOb = new Windows.Web.Http.HttpClient();
Uri connectionUrl = new Uri("http://www.helloworld.com/istar/fileupload/Lip?");
string framURL = UTCdatetime + "," + lng + "," + lat + "," + speed + alt + "," + "," + battery_level + "," + accuracy;
Dictionary<string, string> pairs = new Dictionary<string, string>();
pairs.Add("name", Image_file_name);
pairs.Add("frame", framURL);
//Here is My Content Form.
Windows.Web.Http.HttpFormUrlEncodedContent formContent = new Windows.Web.Http.HttpFormUrlEncodedContent(pairs);
我正在对 FormContent 进行编码。喜欢
{name=WP_20160224_002.jpg&frame=927858b101b71083f37549517819d6ac%2C20160225125928%2C%2C%2C%2C%2C%2C%2C100%2C%2C2%2C%2C%2C0}
我需要使用逗号发送请求,所以我想删除“%2C”。请帮助解决这个问题。
我需要像这样的上述内容形式...
{name=WP_20160224_002.jpg&frame=927858b101b71083f37549517819d6ac,20160225092908,74.253794,31.471193,-1,-1,0,,100,103,2,-1,0}
我在这里发送帖子请求。
Windows.Web.Http.HttpResponseMessage response = await clientOb.PostAsync(connectionUrl, formContent);
【问题讨论】:
标签: c# .net post windows-phone-8.1