IIS 5 & IIS 6
How to use get the response content html and save it to text file?
Last post Jan 12, 2018 06:16 AM by Yuk Ding
Jan 11, 2018 05:02 PM|suchanewbee|LINK
I'm learning how to use asp to develop a web crawler. So I need to get the repsonse html and save it to text file. Then I can analyze the html based on the saved data. Does anyone have idea about how to achieve this? Thanks in advance.
Jan 12, 2018 06:16 AM|Yuk Ding|LINK
This link provide a sample for the web crawler:
In addition, I could provide the asp.net application sample:
string targetpath = @"d:\webcrawler\test.txt";
Console.WriteLine("Please enter the target URL:");
string URI = Console.ReadLine();
WebRequest myrequest = WebRequest.Create(URI);
WebResponse myresponse= myrequest.GetResponse();
Stream datastream = myresponse.GetResponseStream();
StreamReader reader = new StreamReader(datastream, Encoding.Default);
string htmlcontent = reader.ReadToEnd();