我需要通过程序来获取网页的内容,我的代码如下:/// <summary>
/// 获取网页信息
/// </summary>
/// <param name="nId"></param>
static public void GetText(int nId)
{
int count = 0;
byte[] buf = new byte[BUFFER_SIZE];
string strUrl="http://www.sina.com.cn"; HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(strUrl); string postData="data="+nId.ToString(); ASCIIEncoding encoding=new ASCIIEncoding();
byte[]  byte1=encoding.GetBytes(postData);
myHttpWebRequest.ContentType="application/x-www-form-urlencoded";
myHttpWebRequest.ContentLength=postData.Length;
myHttpWebRequest.Method = "POST";
Stream newStream1 = myHttpWebRequest.GetRequestStream();
newStream1.Write(byte1,0,byte1.Length);
myHttpWebRequest.AllowAutoRedirect = false; HttpWebResponse objHwrp = (HttpWebResponse)myHttpWebRequest.GetResponse();

// Console.ReadLine();
// Console.WriteLine(objHwrp.ContentLength.ToString());
Stream newStream=objHwrp.GetResponseStream();

count = newStream.Read(buf, 0, buf.Length);
string retHtml = Encoding.Default.GetString(buf,0,count);

Console.Write(retHtml); get.FileWrite("c:\\aaa.txt",retHtml);
newStream.Close();
}但是现在有个非常棘手的问题就是,获取到的字符的内容是比网页实际的内容小很多,也就是不能完整的获取到网页的源代码内容. 
如果在 Stream newStream=objHwrp.GetResponseStream(); 上面暂停一下的话,获取到的内容正确了.
我觉得这可能和同步问题有关,请高手指点.如果能帮我修改一下代码就更好了,在此先谢谢了