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

是非成败转头空 青山依旧在 几度夕阳红 。。。
随笔 - 1274, 文章 - 0, 评论 - 214, 阅读 - 320万
  博客园  :: 首页  :: 管理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

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;

编辑推荐:
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
阅读排行:
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期
· 全程使用 AI 从 0 到 1 写了个小工具
· 从文本到图像:SSE 如何助力 AI 内容实时呈现?(Typescript篇)
历史上的今天:
2006-11-07 主表和子表数据同时在绑定控件显示(示例代码下载)
2006-11-07 Asp.net 2.0 用 FileUpload 控件实现多文件上传 用户控件
点击右上角即可分享
微信分享提示