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://blog.csdn.net/attilax
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