的含义是什么?
ContentType =“application / x-www-form-urlencoded” 在HTTP Post方法.. ??
我的代码是
Uri url = new Uri(" http://blah/blah/blah...json");
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
答案 0 :(得分:3)
我在特定项目中一直使用ContentType =“application / x-www-form-urlencoded”。我所知道的是,它是使用的方案,因此您发送到服务器的POST参数采用urlencoded格式。例如,如果您发送参数键值,如下所示:
name=Agung
id=121
然后,当您发送请求时,POST主体将像编码一样:
name=Agung&id=121
当您设置ContentType =“application / x-www-form-urlencoded”时,服务器将知道如何解析您正在发送的Body参数。
希望它会有所帮助
答案 1 :(得分:-1)
这用于安全目的。
您可以获得更多帮助here。