I need to login a page which uses captcha image, what I do is:
1- Download the captcha image using WebClient into memory.
2- Do OCR to the image and extract the code.
3- Post the login details and the code using WebBrowser.
Example:
WebBrowser1.Navigate("URL", "", paramInByte, "Content-Type:application/x-www-form-urlencoded")
I think the WebBrowser requires another captcha image before login and I get wrong code error.
It was working a few months ago so I think they changed the site.
How can I solve this issue? I might need to pass WebClient’s cookies, headers, queries etc to the WebBrowser, but I don’t know how to communicate between them.
I found this (w is the WebBrowser Object);
First I set the WebBrowser size to the captcha image size, because the code below will take the visible part in the WebBrowser, but the WebBrowser itself doesn’t have to be visible.
Also OLE32 Class should be declared
This way I can get the controls content as bmp and do OCR without requesting new page.