使用DDE获取网页的来源

时间:2014-04-01 14:37:13

标签: c# vb.net dde ndde

确定。我知道我可以使用DDE获取网页的URL,甚至可以在外部webbrowser(如Firefox)中打开特定页面。我想知道获取所显示网页的来源需要什么。如果有人可以帮助我会非常感激。我正在使用vb.net,但我可以轻松地使用任何C#示例。我用谷歌搜索,似乎找不到多少。

1 个答案:

答案 0 :(得分:1)

粗暴准备,但是:

using System;

namespace So2
{
    class Program
    {
        public static void Main(string[] args)
        {

            System.Net.WebRequest req = System.Net.WebRequest.Create("http://www.google.com");

            System.Net.WebResponse response = req.GetResponse();

            string source = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd();

            Console.WriteLine(source);

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
    }
}
相关问题