如何从httpresponsemessage获取验证码图像 [英] How do I get a captcha image from a httpresponsemessage

查看:91
本文介绍了如何从httpresponsemessage获取验证码图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我正在使用HttpClient获取页面内容。



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();
               }
           }





Captcha部分是这样的:





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.

推荐答案

(document).ready(function(){
(document).ready(function () {


('#Captcha')。val('');
('#Captcha').val('');


('#Cbtn')。click(function(){
('#Cbtn').click(function () {


这篇关于如何从httpresponsemessage获取验证码图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆