public Task <ActionResult> Get(string signature, string timestamp, string nonce, string echostr) { return(Task.Factory.StartNew <string>(delegate { if (CheckSignature.ValidateSignature(signature, timestamp, nonce, echostr, TOKEN)) { return echostr; } return "接入微信失败"; }).ContinueWith <ActionResult>(t => base.Content(t.Result))); }
public Task <ActionResult> Post(string signature, string timestamp, string nonce, string echostr) { return(Task.Factory.StartNew <string>(delegate { if (!CheckSignature.ValidateSignature(signature, timestamp, nonce, echostr, TOKEN)) { return "参数错误"; } StreamReader textReader = new StreamReader(this.Request.InputStream, Encoding.UTF8); return ReceiveMessage.HandleWXMessage(XDocument.Load(textReader)); }).ContinueWith <ActionResult>(t => base.Content(t.Result))); }