明天的明天 永远的永远 未知的一切 我与你一起承担 ??

是非成败转头空 青山依旧在 几度夕阳红 。。。
  博客园  :: 首页  :: 管理

request.BeginGetRequestStream 报错! 无法发送具有此谓词类型的内容正文。


注意此方法:

 //////request.Method = "GET";   //若不为异步,则调用此方法。


 request.Method = "POST";  //若为异步,则调用此方法。


 
try
            {
                request = WebRequest.Create(string.Format(getUri, webURI, betInfor.Row.PlayID, uID, pType, gNum)) as HttpWebRequest;

                //////request.Method = "GET";   //若不为异步,则调用此方法。


                request.Method = "POST";  //若为异步,则调用此方法。
                request.KeepAlive = true;
                request.Timeout = 400;
                if (betInfor.PlayMode == PlayMode.走)
                    request.Referer = string.Format("{0}app/member/BK_browse/body_browse.php?uid={1}&rtype=re&langx=zh-cn&mtype=3&delay=", webURI, uID);
                else if (betInfor.PlayMode == PlayMode.单)
                    request.Referer = string.Format("{0}app/member/BK_browse/body_browse.php?uid={1}&rtype=r&langx=zh-cn&mtype=3&delay=", webURI, uID);
                request.UserAgent = "MSIE 6.0";

                //******************************************异步调用
                request.BeginGetRequestStream(new AsyncCallback(RequestCallBack), request);
                allDone.WaitOne();


                response = (HttpWebResponse)request.GetResponse();
                stream = response.GetResponseStream();
                Thread.Sleep(1);
                StreamReader streamRead = new StreamReader(stream, big5);
                result = streamRead.ReadToEnd();
                stream.Close();
                streamRead.Close();               
                //**********************************************************
                //////response = request.GetResponse() as HttpWebResponse;
                //////stream = response.GetResponseStream();
                //////StreamReader sr = null;
                //////sr = new StreamReader(stream, big5);
                //////while ((count = sr.Read(leftBuffer, 0, leftBuffer.Length)) > 0)
                //////{
                //////    String str = new String(leftBuffer, 0, count);
                //////    leftSb.Append(str);
                //////}
                //////sr.Close();

                #region 提取数据
                //////result = leftSb.ToString();
                if (result.IndexOf("中") != -1 || betInfor.PlayMode == PlayMode.单)
                {
                    
                }
                #endregion
            }
            catch (Exception e) { throw new Exception("获取左边出现异常" + result + e.Message + "," + e.TargetSite + "," + e.InnerException); }
            finally
            {
                if (response != null) response.Close();
                if (request != null) request.Abort();
               
                leftSb.Remove(0, leftSb.Length);
            }
            if (!string.IsNullOrEmpty(gmin_single) && ((int)((betInfor.Odds + 0.0001) * 1000)) % 10 == 0)//小数第3位有数字为会取消的单
            {
              
            }
            else betInfor.Odds = 0;
            time2 = Environment.TickCount;
            betInfor.GetTime = time2 - time1;
            return result;