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. Saving file using WebBrowser control

Saving file using WebBrowser control

Scheduled Pinned Locked Moved C#
helpquestion
3 Posts 3 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.
  • A Offline
    A Offline
    Atul Kharecha
    wrote on last edited by
    #1

    I am using WebBrowser control and I want to save the loaded page from my application. I am using following code. webBrowser1.ShowSaveAsDialog(); This shows save dialog box but after that I want to add code whether user has clicked on Save or Cancel button. This method returns void so I am not able to decide what happend after showing dialog box. Can any help ? Thanks.

    T 1 Reply Last reply
    0
    • A Atul Kharecha

      I am using WebBrowser control and I want to save the loaded page from my application. I am using following code. webBrowser1.ShowSaveAsDialog(); This shows save dialog box but after that I want to add code whether user has clicked on Save or Cancel button. This method returns void so I am not able to decide what happend after showing dialog box. Can any help ? Thanks.

      T Offline
      T Offline
      Tamer Oz
      wrote on last edited by
      #2

      try using httprequest if user is not logging in or filling any data on form. HttpWebRequest req = (HttpWebRequest)(WebRequest.Create(PostUrl)); req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1)"; req.Method = "GET"; req.KeepAlive = false; req.Timeout = 1000000; req.Proxy = WebProxy.GetDefaultProxy(); req.Proxy.Credentials = CredentialCache.DefaultCredentials; HttpWebResponse res = ((HttpWebResponse)req.GetResponse()); StreamReader sr = new StreamReader(res.GetResponseStream(), Encoding.GetEncoding("iso-8859-9")); result = sr.ReadToEnd();

      B 1 Reply Last reply
      0
      • T Tamer Oz

        try using httprequest if user is not logging in or filling any data on form. HttpWebRequest req = (HttpWebRequest)(WebRequest.Create(PostUrl)); req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1)"; req.Method = "GET"; req.KeepAlive = false; req.Timeout = 1000000; req.Proxy = WebProxy.GetDefaultProxy(); req.Proxy.Credentials = CredentialCache.DefaultCredentials; HttpWebResponse res = ((HttpWebResponse)req.GetResponse()); StreamReader sr = new StreamReader(res.GetResponseStream(), Encoding.GetEncoding("iso-8859-9")); result = sr.ReadToEnd();

        B Offline
        B Offline
        Brandon X
        wrote on last edited by
        #3

        I believe the WebBrowser class also has properties .Document and .DocumentText see this: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.document(VS.85).aspx[^] as well as: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documenttext(VS.85).aspx[^] in the past for simple stuff I've just saved off the .DocumentText stuff to a file since I was just populating simple html to the control; but whatevers clever for you.

        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