请高手支招啊。
还是HttpWebRequest.Expectd在post的时候出现的问题。
我在网上看到有人说这个一个BUG,地址http://www.dotnet247.com/247reference/msgs/31/158004.aspx
但是我用2005出来的程序一样在post的时候会出现Expect: 100-continue。
这样会比IE post数据的时候多一个服务器响应。
我的代码改成如下的时候:
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.PreAuthenticate = true;
req.KeepAlive = true;
req.ProtocolVersion = HttpVersion.Version11;
req.Method = "POST ";
//req.Timeout = 60000;
req.Accept= "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */* ";
req.Referer = referer;
req.Headers.Add( "Accept-Language: zh-cn ");
req.ContentType = "application/x-www-form-urlencoded ";
req.Headers.Add( "UA-CPU ", "x86 ");
req.AllowAutoRedirect = true;
req.Headers.Add( "Accept-Encoding: gzip, deflate ");
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) ";
req.Headers.Add( "Cache-Control: no-cache ");
StringBuilder UrlEncoded = new StringBuilder();
Char[] reserved = { '? ', '= ', '& ' };
byte[] SomeBytes = null;