save the source code of a particular URl  
Author Message
karthik.sr





PostPosted: .NET Framework Networking and Communication, save the source code of a particular URl Top

Hi,

How can i save the source code of a particular URl in a single button click
It shud be saved in a specfic location of my drive.
The thing is if we do Alt+VC[shortcut key]we will get the souce code of that URL
in a notepad.Now this note pad shud be saved........
How can this be done dynamically I am struck in this.....Please help me out...



with regards,

Karthik



.NET Development6  
 
 
Sean Hederman





PostPosted: .NET Framework Networking and Communication, save the source code of a particular URl Top

Well, I wouldn't use IE for this. I'd write a small little app that just used HttpWebRequest to retrieve the html from a URL.



 
 
RizwanSharp





PostPosted: .NET Framework Networking and Communication, save the source code of a particular URl Top

Here:

HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create("http://www.microsoft.com");

HttpWebResponse webResp = (HttpWebResponse)webReq.GetResponse();

Stream ms = webResp.GetResponseStream();

StreamReader sr = new StreamReader(ms);

Console.Write(sr.ReadToEnd());

webResp.Close();

sr.Close();

I hope this will help.

Best Regards,

Rizwan aka RizwanSharp