.net c# 如何获指定地址的网页内容标签

//捉取页面

    protected void Button1_Click(object sender, EventArgs e)

    {

        WebRequest webRequest = WebRequest.Create(this.txtSearch.Text.Trim());



        WebResponse webResponse = webRequest.GetResponse();



        Stream stream = webResponse.GetResponseStream();



        //StreamReader sr = new StreamReader(stream);



        StreamReader sr = new StreamReader(stream, Encoding.Default);

        StringBuilder sb = new StringBuilder();



        string str=string.Empty;



        while ((str = sr.ReadLine()) != null)

        {

            sb.Append(str).Append("<br/>");

        }



        this.div.Value = sb.ToString();

        this.div2.InnerHtml = sb.ToString();



    }

你可能感兴趣的:(.net)