HTML code to .TXT
-
Hi everybody! I have a question to do: how can i download the HTML code of an internet page, and save it in .txt? help me plz...
-
Hi everybody! I have a question to do: how can i download the HTML code of an internet page, and save it in .txt? help me plz...
Your browser does that - only it renders it. You can, in your browser, select "File -> Save As" and save it as an HTML page, then open it up in a vanilla (plain) text editor. If you want to do this programmatically, see the example in the documentation for the HttpWebRequest.GetResponse[^] method. Just save it to a file instead of using the
Console
. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog] -
Hi everybody! I have a question to do: how can i download the HTML code of an internet page, and save it in .txt? help me plz...
You can also use RegEx to strip the html tags from the response.
public string cleanHtmlTags(string inputText) { Regex objRejex = new Regex("<([^>]*?)>"); return objRejex.Replace(inputText, ""); }
"If knowledge can create problems, it is not through ignorance that we can solve them." -- Isaac Asimov -
Your browser does that - only it renders it. You can, in your browser, select "File -> Save As" and save it as an HTML page, then open it up in a vanilla (plain) text editor. If you want to do this programmatically, see the example in the documentation for the HttpWebRequest.GetResponse[^] method. Just save it to a file instead of using the
Console
. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]