页面上放一个按钮,一个层(runat="server")
protected void Button1_Click(object sender, EventArgs e)
{
string strResult = "";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"http://www.dangdang.com");
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream streamReceive = response.GetResponseStream();
Encoding encoding = Encoding.GetEncoding("gb2312");
StreamReader streamReader = new StreamReader(streamReceive, encoding);
strResult = streamReader.ReadToEnd();
div1.InnerHtml = strResult;
}
···
···