Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. HTML code to .TXT

HTML code to .TXT

Scheduled Pinned Locked Moved C#
questionhtmlhelp
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    ventomito
    wrote on last edited by
    #1

    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...

    Y H D 3 Replies Last reply
    0
    • V ventomito

      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...

      Y Offline
      Y Offline
      Yoyosch
      wrote on last edited by
      #2

      u mean with ur browser?

      V 1 Reply Last reply
      0
      • Y Yoyosch

        u mean with ur browser?

        V Offline
        V Offline
        ventomito
        wrote on last edited by
        #3

        i need the code of an internet page i put in input...all ways are allowed!

        1 Reply Last reply
        0
        • V ventomito

          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...

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          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]

          V 1 Reply Last reply
          0
          • V ventomito

            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...

            D Offline
            D Offline
            Daniel Bright
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • H Heath Stewart

              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]

              V Offline
              V Offline
              ventomito
              wrote on last edited by
              #6

              Thank You very much Mr. Heath Stewart! Exactly i needed! Thank You again Enricop

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups