byte[] buffer = request.GetPreloadedEntityBody();
次句意思是返回Http正文已经被读取部分;
在2003下一切正常,结果到2005下总是返回null?
此代码用于大文件上传Httpmodule类中.
百分相赠解答正确者!

解决方案 »

  1.   

    http://community.csdn.net/Expert/topic/5264/5264108.xml?temp=.2642633
    这里也还有个问题 大家帮忙解决下吧
      

  2.   

    HttpWorkerRequest.GetPreloadedEntityBody () 返回 HTTP 请求正文已被读取的部分
      

  3.   

    看看System.Web.HttpWorkerRequest代替 request后,結果會不會不一樣啊?
      

  4.   

    泡泡猫啊,这里的request就是HttpWorkerRequest的实例
      

  5.   

    http://topic.csdn.net/t/20040314/21/2842268.html
    怎样从 HttpWorkerRequest 中读取 用户请求的数据?
    看看這個貼子有沒有幫助,里面有思歸老大的回復哦=======================
    2 楼saucer(思归)回复于 2004-03-14 21:34:30 得分 100something   like   
        
        
          IServiceProvider   provider   =   (IServiceProvider)   HttpContext.Current;     
          HttpWorkerRequest   wr   =   (HttpWorkerRequest)   provider.GetService(typeof(HttpWorkerRequest));   
          string   addr   =   wr.GetLocalAddress();     
          Response.Write(String.Format("NiC   Address:{0}<BR>",   addr));   
          byte[]   bs   =   wr.GetPreloadedEntityBody();   
          String   s   =   "";   
          if   (bs   !=   null   &&   bs.Length   >0)   
            s=   System.Text.Encoding.Default.GetString(bs);   
          Response.Write(s   +   "<BR>");   
          if   (!wr.IsEntireEntityBodyIsPreloaded())   
          {   
      Response.Write("normally   shouldn't   be   here");   
      int   n   =   1024;   
      byte[]   bs2   =   new   byte[n];   
      while   (wr.ReadEntityBody(bs2,n)   >0)   
      {   
      s   =   System.Text.Encoding.Default.GetString(bs2);   
          Response.Write(s   +   "<BR>");   
      }   
          }   
        
      note,   as   IIS   receives   data   on   its   TCP/IP   connection   from   the   browser,   it   sends   a   copy   to   the   ASP.NET   worker   process   through   a   named   pipe.   You   use   ReadEntityBody   to   read   the   data   from   this   pipe.     But   you   might   not   need   to   use   ReadEntityBody   if   the   data   is   not   huge
      

  6.   

    我想你是使用的VS 2005自带的WEB服务器.你应该使用IIS.这样问题就可以解决了.IIS:ISAPIWorkerRequest 其它则是:SimpleWorkerRequest