SIGN UP MEMBER LOGIN:    
Blog

Retrieving content of other page using C#

Posted by Altaf Patel Blogs | ASP.NET using VB.NET Nov 26, 2010
Below code will be useful if you want to read the content of some other page
Import class

<%@ Import Namespace="System.Net"  %>


code:


 

System.Net.WebClient Http = new System.Net.WebClient();
       
try
        {
            byte[] Result = Http.DownloadData("http://www.google.com");
            string Content = Encoding.Default.GetString(Result);
           Response.Write(Encoding.Default.GetString(Result));
       }
        catch (Exception ex)
        {
            Response.Write(ex.Message);    
        }
        Response.End();

 



Any suggestion, changes or modification are welcome. 
share this blog :
post comment