Fengzhimei@Dot.Net
Designing My Colorful Dream

    Someone ask me if there have xmlhttp object in .net,the answer is negative,but you can use the WebRequest class within the System.Net namespace to do similar things.and the example as below(note:must using System.IO namespace):

   WebRequest wReq = WebRequest.Create("the url of resource");
   wReq.Credentials = new NetworkCredential("account","password","domain");
   WebResponse wResp = wReq.GetResponse();
   Stream respStream = wResp.GetResponseStream();
   StreamReader reader = new StreamReader(respStream,Encoding.GetEncoding("gb2312"));
   String respHTML = reader.ReadToEnd();
   Response.Write(respHTML);
   respStream.Close();

posted on 2003-12-18 22:08  fengzhimei  阅读(755)  评论(0编辑  收藏  举报