示例#1
0
        public void Push(WeChatContentBase content)
        {
            HttpWebRequest myrequest = PrepareRequest();

            string contentStr = content.GetContentStr();

            contentStr = contentStr.Replace("#openid#", toUser);
            byte[] postdata = Encoding.GetEncoding("UTF-8").GetBytes(contentStr);
            myrequest.ContentLength = postdata.Length;

            Stream newStream = myrequest.GetRequestStream();

            newStream.Write(postdata, 0, postdata.Length);
            newStream.Close();
            myrequest.BeginGetResponse(null, null);
        }
示例#2
0
        public void Push(WeChatContentBase content)
        {
            HttpWebRequest myrequest = PrepareRequest();

            string contentStr = content.GetContentStr();
            contentStr = contentStr.Replace("#openid#",toUser);
            byte[] postdata = Encoding.GetEncoding("UTF-8").GetBytes(contentStr);
            myrequest.ContentLength = postdata.Length;

            Stream newStream = myrequest.GetRequestStream();
            newStream.Write(postdata, 0, postdata.Length);
            newStream.Close();
            myrequest.BeginGetResponse(null, null);
        }