Atitit. Get the Captcha picture through the web

Source: Internet
Author: User

Atitit. Get Verification code picture by Web

1. WebRequest for lower level access ( not recommended ) 1

2. WebBrowser 1

3. Clipboard Copy method Clipboard ( recommended ) 1

4. C # take WebBrowser picture can be used to get verification code 1

1. WebRequest for lower level access (not recommended)

WebBrowser, always use WebRequest for lower-level access

2. WebBrowser

Recently and a friend to explore the WebBrowser access to the page to verify the image of the method, the first thought is through the WebClient directly to download the current page of the verification code referenced in the image, but then think of this involves a number of problems: one is that the verification code may change every time the request, Second, it is very difficult to associate WebClient with WebBrowser's cookies or even the session.

Then think of can give up WebBrowser, always use WebRequest for the lower level of access, to avoid multiple access to the verification code changes resulting in inconsistencies, but this approach is more complicated to operate.

And then think of this kind of alternative--grab the picture. Just go straight through the WebBrowser and cut out the code outside the CAPTCHA.

Author:: Old Wow's paw attilax Ayron, email:[email protected]

Reprint please indicate source: Http://

3. Clipboard Copy method Clipboard (recommended)4.C # take WebBrowser picture can be used to get verification code

Category:   .net learning 2012-11-01  21:52  2634 People read   comment (1)   collection   Span style= "color: #ca00; Background:rgb (255,255,255) "> report

[CSharp] View plaincopy

1. /// <summary>

2. ///return the picture in the specified webbrowser </IMG>

3. /// </summary>

4. /// <param name= "Webctl" >webbrowser controls </param>

5. /// <param name= "Imgetag" >img elements </param>

6. /// <returns>img objects </returns>

7. Private Image getwebimage (WebBrowser webctl, HtmlElement imgetag)

8. {

9. HTMLDocument doc = (htmldocument) WebCtl.Document.DomDocument;

HTMLBody BODY = (HTMLBody) doc.body;

Ihtmlcontrolrange rang = (ihtmlcontrolrange) body.createcontrolrange ();

ihtmlcontrolelement Img = (ihtmlcontrolelement) imgetag.domelement; //Picture address   

Image oldimage = Clipboard.getimage ();

Rang.add (IMG);

15.      rang.execcommand ( "Copy" ,&NBSP; false ,&NBSP; null );    //Copy to memory &NBSP;&NBSP;

Image numimage = Clipboard.getimage ();

. try

. {

clipboard.setimage (oldimage);

. }

. catch {}

- return numimage;

. }

Javascript Implementation Replication (copy) action method Daquan _javascript Tips _ Scripting House . html

manipulating the Clipboard in Java -#include cannel_2020- Blog channel -CSDN.NET.html

Atitit. Get the Captcha picture through the web

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.