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. captcha image from WebBrowser into a picturebox

captcha image from WebBrowser into a picturebox

Scheduled Pinned Locked Moved C#
helpjavajavascripttools
10 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.
  • Y Offline
    Y Offline
    yogesh_softworld123
    wrote on last edited by
    #1

    I need to be able to place the captcha image into a picturebox on my form, the reason being that I need to zoom the captcha image for the visualy impaired users. It appears to be such a simple task, just take the image from the web page and put it into a picturebox but it is turning out to be not so simple. i have WebBrowser control in form and for registration in one of site, i need captcha image in picture box. problem is that captcha image is generated by JavaScript, when java script runs then it gives url of captcha image. but every time when java script runs, captcha image goes change. i just want that captcha image which is on WebBrowser control current page. Any help would be greatly appreciated.

    yogesh

    A D 2 Replies Last reply
    0
    • Y yogesh_softworld123

      I need to be able to place the captcha image into a picturebox on my form, the reason being that I need to zoom the captcha image for the visualy impaired users. It appears to be such a simple task, just take the image from the web page and put it into a picturebox but it is turning out to be not so simple. i have WebBrowser control in form and for registration in one of site, i need captcha image in picture box. problem is that captcha image is generated by JavaScript, when java script runs then it gives url of captcha image. but every time when java script runs, captcha image goes change. i just want that captcha image which is on WebBrowser control current page. Any help would be greatly appreciated.

      yogesh

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      No you cant create pictures using Javascript. You need to generate the picture in the serverside using Bitmap object. This might help you CAPTCHA Image[^] :)

      Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


      My Latest Articles-->** Microsoft Bing MAP using Javascript
      CLR objects in SQL Server 2005
      Uncommon C# Keywords
      /xml>

      Y 1 Reply Last reply
      0
      • A Abhishek Sur

        No you cant create pictures using Javascript. You need to generate the picture in the serverside using Bitmap object. This might help you CAPTCHA Image[^] :)

        Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


        My Latest Articles-->** Microsoft Bing MAP using Javascript
        CLR objects in SQL Server 2005
        Uncommon C# Keywords
        /xml>

        Y Offline
        Y Offline
        yogesh_softworld123
        wrote on last edited by
        #3

        i dont want to create captcha using javascript. i just told that captcha link comes when javascript runs.

        yogesh

        modified on Saturday, October 24, 2009 1:49 PM

        A 1 Reply Last reply
        0
        • Y yogesh_softworld123

          i dont want to create captcha using javascript. i just told that captcha link comes when javascript runs.

          yogesh

          modified on Saturday, October 24, 2009 1:49 PM

          A Offline
          A Offline
          Abhishek Sur
          wrote on last edited by
          #4

          you need to change the size of the image ? why dont you use javascript to do this?? set <img style="width:100px; height:100px" /> using javascript when user wants to zoom the image.

          Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


          My Latest Articles-->** Microsoft Bing MAP using Javascript
          CLR objects in SQL Server 2005
          Uncommon C# Keywords
          /xml>

          Y 1 Reply Last reply
          0
          • A Abhishek Sur

            you need to change the size of the image ? why dont you use javascript to do this?? set <img style="width:100px; height:100px" /> using javascript when user wants to zoom the image.

            Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


            My Latest Articles-->** Microsoft Bing MAP using Javascript
            CLR objects in SQL Server 2005
            Uncommon C# Keywords
            /xml>

            Y Offline
            Y Offline
            yogesh_softworld123
            wrote on last edited by
            #5

            i think, you have not read my message carefully. ok i am explaining again, if you are going to create account in facebook.com, captcha will come there. if you see the page source then you can not get any specifice captcha url, you only get one link, and this links calls java script. whenever java script runs captcha url comes to webpage.

            yogesh

            A 1 Reply Last reply
            0
            • Y yogesh_softworld123

              i think, you have not read my message carefully. ok i am explaining again, if you are going to create account in facebook.com, captcha will come there. if you see the page source then you can not get any specifice captcha url, you only get one link, and this links calls java script. whenever java script runs captcha url comes to webpage.

              yogesh

              A Offline
              A Offline
              Abhishek Sur
              wrote on last edited by
              #6

              Hey ultimately it goes to a handler right. So calling the handler again will create a new image. If javascript calles the handler then it should create an img tag. In your case, if you have an HTTPhandler you can easily write the captcha image in the output stream and through javascript create an img tag and place the image. Now place a button to enlarge the existing image using var img = document.getElementById('yourimgkey'); img.style.width = '100px'; img.style.height = '100px'; That will do the trick I think. why do you require to request to the server again. I know its an issue when you are hitting the server side again, the captcha image will change. If still have problems, Please drop some code that you have done for your website so that I could get more about the actual problem you are facing. :) :) :thumbsup:

              Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


              My Latest Articles-->** Microsoft Bing MAP using Javascript
              CLR objects in SQL Server 2005
              Uncommon C# Keywords
              /xml>

              Y 1 Reply Last reply
              0
              • A Abhishek Sur

                Hey ultimately it goes to a handler right. So calling the handler again will create a new image. If javascript calles the handler then it should create an img tag. In your case, if you have an HTTPhandler you can easily write the captcha image in the output stream and through javascript create an img tag and place the image. Now place a button to enlarge the existing image using var img = document.getElementById('yourimgkey'); img.style.width = '100px'; img.style.height = '100px'; That will do the trick I think. why do you require to request to the server again. I know its an issue when you are hitting the server side again, the captcha image will change. If still have problems, Please drop some code that you have done for your website so that I could get more about the actual problem you are facing. :) :) :thumbsup:

                Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


                My Latest Articles-->** Microsoft Bing MAP using Javascript
                CLR objects in SQL Server 2005
                Uncommon C# Keywords
                /xml>

                Y Offline
                Y Offline
                yogesh_softworld123
                wrote on last edited by
                #7

                here is my code. public void FacebookRegistration() { HTMLDoc = (mshtml.HTMLDocument)WBrowser.Document.DomDocument; iHTMLCol = HTMLDoc.getElementsByTagName("input"); foreach (IHTMLElement iHTMLEle in iHTMLCol) { if (iHTMLEle.getAttribute("name", 0) != null) { strAttriName = iHTMLEle.getAttribute("name", 0).ToString(); if (strAttriName == "firstname") { iHTMLEle.setAttribute("value", FirstName, 0); continue; } if (strAttriName == "lastname") { iHTMLEle.setAttribute("value", LastName, 0); continue; } if (strAttriName == "reg_email__") { iHTMLEle.setAttribute("value", EmailID, 0); continue; } if (strAttriName == "reg_passwd__") { string s = GetRandomString(); Random ran = new Random(); iHTMLEle.setAttribute("value", s+ran.Next(1111,9999), 0); break; } } } iHTMLCol = HTMLDoc.getElementsByTagName("option"); foreach (IHTMLElement iHTMLEle in iHTMLCol) { try { if (iHTMLEle.innerText.Contains("Male")) { iHTMLEle.setAttribute("selected", "selected",0); } if (iHTMLEle.innerText.Contains("Jun")) { iHTMLEle.setAttribute("selected", "selected", 0); } Random ran = new Random(); if (iHTMLEle.innerText.Contains("4")) { iHTMLEle.setAttribute("selected", "selected", 0); } Random ran1 = new Random(); if (iHTMLEle.innerText.Contains(ran1.Next(1920,1985).ToString())) { iHTMLEle.setAttribute("selected", "selected", 0); } } catch { } } iHTMLCol = HTMLDoc.getElementsByTagName("input"); int

                C A 2 Replies Last reply
                0
                • Y yogesh_softworld123

                  here is my code. public void FacebookRegistration() { HTMLDoc = (mshtml.HTMLDocument)WBrowser.Document.DomDocument; iHTMLCol = HTMLDoc.getElementsByTagName("input"); foreach (IHTMLElement iHTMLEle in iHTMLCol) { if (iHTMLEle.getAttribute("name", 0) != null) { strAttriName = iHTMLEle.getAttribute("name", 0).ToString(); if (strAttriName == "firstname") { iHTMLEle.setAttribute("value", FirstName, 0); continue; } if (strAttriName == "lastname") { iHTMLEle.setAttribute("value", LastName, 0); continue; } if (strAttriName == "reg_email__") { iHTMLEle.setAttribute("value", EmailID, 0); continue; } if (strAttriName == "reg_passwd__") { string s = GetRandomString(); Random ran = new Random(); iHTMLEle.setAttribute("value", s+ran.Next(1111,9999), 0); break; } } } iHTMLCol = HTMLDoc.getElementsByTagName("option"); foreach (IHTMLElement iHTMLEle in iHTMLCol) { try { if (iHTMLEle.innerText.Contains("Male")) { iHTMLEle.setAttribute("selected", "selected",0); } if (iHTMLEle.innerText.Contains("Jun")) { iHTMLEle.setAttribute("selected", "selected", 0); } Random ran = new Random(); if (iHTMLEle.innerText.Contains("4")) { iHTMLEle.setAttribute("selected", "selected", 0); } Random ran1 = new Random(); if (iHTMLEle.innerText.Contains(ran1.Next(1920,1985).ToString())) { iHTMLEle.setAttribute("selected", "selected", 0); } } catch { } } iHTMLCol = HTMLDoc.getElementsByTagName("input"); int

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  Basically, the idea is that they are trying to stop exactly what you're trying to do, and seem to be doing so successfully.

                  Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                  1 Reply Last reply
                  0
                  • Y yogesh_softworld123

                    here is my code. public void FacebookRegistration() { HTMLDoc = (mshtml.HTMLDocument)WBrowser.Document.DomDocument; iHTMLCol = HTMLDoc.getElementsByTagName("input"); foreach (IHTMLElement iHTMLEle in iHTMLCol) { if (iHTMLEle.getAttribute("name", 0) != null) { strAttriName = iHTMLEle.getAttribute("name", 0).ToString(); if (strAttriName == "firstname") { iHTMLEle.setAttribute("value", FirstName, 0); continue; } if (strAttriName == "lastname") { iHTMLEle.setAttribute("value", LastName, 0); continue; } if (strAttriName == "reg_email__") { iHTMLEle.setAttribute("value", EmailID, 0); continue; } if (strAttriName == "reg_passwd__") { string s = GetRandomString(); Random ran = new Random(); iHTMLEle.setAttribute("value", s+ran.Next(1111,9999), 0); break; } } } iHTMLCol = HTMLDoc.getElementsByTagName("option"); foreach (IHTMLElement iHTMLEle in iHTMLCol) { try { if (iHTMLEle.innerText.Contains("Male")) { iHTMLEle.setAttribute("selected", "selected",0); } if (iHTMLEle.innerText.Contains("Jun")) { iHTMLEle.setAttribute("selected", "selected", 0); } Random ran = new Random(); if (iHTMLEle.innerText.Contains("4")) { iHTMLEle.setAttribute("selected", "selected", 0); } Random ran1 = new Random(); if (iHTMLEle.innerText.Contains(ran1.Next(1920,1985).ToString())) { iHTMLEle.setAttribute("selected", "selected", 0); } } catch { } } iHTMLCol = HTMLDoc.getElementsByTagName("input"); int

                    A Offline
                    A Offline
                    Abhishek Sur
                    wrote on last edited by
                    #9

                    So you are making a windows application which will load the Facebook application to its web browser control. First of all, you need to remember, if you are going to call the server again, it will load the CAPTCHA again. This is the basic feature of CAPTCHA. Rather if your motive is to zoom the image, you need to find the img control which loads the captcha and then apply CSS width and height. Just try to find the actual img control that loads the captcha. I am sure that must be one. :)

                    Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


                    My Latest Articles-->** Microsoft Bing MAP using Javascript
                    CLR objects in SQL Server 2005
                    Uncommon C# Keywords
                    /xml>

                    1 Reply Last reply
                    0
                    • Y yogesh_softworld123

                      I need to be able to place the captcha image into a picturebox on my form, the reason being that I need to zoom the captcha image for the visualy impaired users. It appears to be such a simple task, just take the image from the web page and put it into a picturebox but it is turning out to be not so simple. i have WebBrowser control in form and for registration in one of site, i need captcha image in picture box. problem is that captcha image is generated by JavaScript, when java script runs then it gives url of captcha image. but every time when java script runs, captcha image goes change. i just want that captcha image which is on WebBrowser control current page. Any help would be greatly appreciated.

                      yogesh

                      D Offline
                      D Offline
                      dan sh
                      wrote on last edited by
                      #10

                      yogesh_softworld123 wrote:

                      I need to zoom the captcha image for the visualy impaired users.

                      Why not go for the audio facility? Wouldn't that be better?

                      It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

                      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