输入String propertyId = request.getParameterValues(propertyId);或String propertyId = request.getParameterValues(propertyId );
这渣塌粗两种方法都可以,只是适用的的方式不同。
post方法:
/// <summary> ///
使用post方法,调用短信接口
/// </summary>衫孝
/// <param name="PhoneNumber"></param> 如镇
/// <param name="SmsContent"></param>
/// <param name="PhoneNumberType"></param>
/// <param name="SmsUser"></param>
private void CallMsgCenterToSendMsgPost(string PhoneNumber,
string SmsContent, string PhoneNumberType, string SmsUser)
{
string formUrl =
ConfigurationSettings.AppSettings["formUrl"].ToString().Trim();//url
地址
string formData = "PhoneNumber=" + PhoneNumber +
"&SmsContent=" +SmsContent + "&PhoneNumberType=" + PhoneNumberType +
"&SmsUser=" + SmsUser + "";
CookieContainer cookieContainer = new CookieContainer()
//添加程序清闷集System.Web.Extensions.dll
using System.Web.Script.Serialization;
JavaScriptSerializer js = new JavaScriptSerializer();
剩下的,就看你有没有与传递过来的json对哗燃应的实体类了,如果没有,那你只能把传递过来的数据反序列化为字乱正虚典格式。
额 大哥 详细点
你现在得到了post传递过来的数据了吗?把它复制上来。
2016-03-07 · 百度知道合伙人官方认证企业
1、定义json:
var account = {
number : "123456"激备,
name: "Justin",
balance: "1000"
};
2、发运亮送post请求:
function handleAccount() {
var json = prepareJSON();
var url = "Handler1.ashx?timeStamp" + new Date().getTime();
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("POST", url);
xmlHttp.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
xmlHttp.send(account );
}
3、Handler1中的中ProcessRequest代码如下:
public void ProcessRequest(HttpContext context)
{
HttpRequest request = context.Request;
Stream stream = request.InputStream;
string json = string.Empty;
string responseJson = string.Empty;
if (stream.Length != 0)
{
StreamReader streamReader = new StreamReader(stream);
json = streamReader.ReadToEnd();
Person person = JSONHelper.Deserialize<Person>(json);
person.FirstName = "FN";
person.LastName = "LN";
responseJson = JSONHelper.Serialize<Person>(person);
}
if (!string.IsNullOrEmpty(responseJson))
{
context.Response.ContentType = "明悄毁text/plain";
context.Response.ContentType = "UTF-8";
context.Response.Write(responseJson);
}
}