I use var content = Request.Content.ReadAsStringAsync().Result; to get that data posted to mine is
<xml><OpenId><![CDATA[oX2XXXXXX-HFCR8O_BkI]]></OpenId>
<AppId><![CDATA[wxbcXXXXXX4d]]></AppId>
<IsSubscribe>0</IsSubscribe>
<ProductId><![CDATA[XXXXXX01]]></ProductId>
<TimeStamp>1416482878</TimeStamp>
<NonceStr><![CDATA[XXXXXXX]]></NonceStr>
<AppSignature><![CDATA[cff4XXXXXX8a513891f0]]></AppSignature>
<SignMethod><![CDATA[sha1]]></SignMethod>
</xml>
And I've crated the structure
public class PackageModal
{
public string OpenId { get; set; }
public string AppId { get; set; }
public string IsSubscribe { get; set; }
public string ProductId { get; set; }
public string TimeStamp { get; set; }
public string NonceStr { get; set; }
public string AppSignature { get; set; }
public string SignMethod { get; set; }
}
But in the controller, [HttpPost]
public string PostNotify(PackageModal modal)
{
....
}
Why the modal is null? Do I need to specify that posted data is XML-format?