Click here to Skip to main content
15,890,370 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,
I am using "HttpClient" go get a content of a page.

using (HttpResponseMessage response = await client.GetAsync(URl))
           {
               using (HttpContent content = response.Content)
               {
                   string myContent = await content.ReadAsStringAsync();
               }
           }


the Captcha section is coming like this:

<script type="text/javascript">
    $(document).ready(function () {
        $('#Captcha').val('');
        $('#Cbtn').click(function () {
            $('#Cimage').attr('src', function () {
                if ($("#Key").length>0)
                    return "/Common/GetRandomCaptchaImage" + '?' + Math.random() + "&key=" + $('#Key').val();
                else
                    return "/Common/GetRandomCaptchaImage" + '?' + Math.random();
            });
        });
        $('#Cbtn').trigger('click');
    });
</script>
<div>
<img id="Cimage" style="height:30px;width:150px;"/>  


How can I get the Captcha Image.

Thanks.

What I have tried:

I tried to put the result into a web browser control but no result.
Thanks.
Posted
Updated 23-Jan-17 10:38am
Comments
Jochen Arndt 2-Jan-17 7:20am    
The web site uses jQuery. So you can't execute it by putting the result into a web browser control.

If you only want to load the captcha you can try it by building the URL (append the shown path to the domain using a random number). But this may fail too when the server uses additional checks to avoid solving the captcha programmatically.

If that is your intention (solving the captcha programmatically) you would get no answer here.
Mohammad Al Hoss 2-Jan-17 7:24am    
No I do not want to solve it problematically.
I want to display it for the users to type it, then after I post the username and password to login.


1 solution

HI Mohammad Al Hoss

I understand what do you mean, but let me tell you something.
AS you wish request all the BODY (bitsEncode), its really hard to prevent when a thirdparty captcha control is refreshed. and as a matter of fact, the captcha is only a parameter of many parameters (normally) for get access to some site.

I think this link could help you to do your own local control captcha and avoid to request that web.

A CAPTCHA Server Control for ASP.NET[^]

Best regards
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900