示例#1
0
        public string GetPage(string url)
        {
            string    data      = string.Empty;
            WebClient webClient = null;

            try
            {
                webClient = new WebClient();
                data      = webClient.DownloadString(url);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(data);
        }
示例#2
0
        public string GetPage(string url)
        {
            string data = string.Empty;

            //WebClient webClient = null;

            try
            {
                //webClient = new WebClient();
                data = webClient.DownloadString(url);
                webClient.DownloadFile(url, url + ".htm");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            //if (webClient != null)
            //{
            //    webClient.Dispose();
            //}

            return(data);
        }