日期:2014-05-20  浏览次数:20877 次

关于HttpWebRequest 连接能访问,提交后出现404
网页源代码:(没有form标签)

<input id="inputCode" name="inputCode" class="inputW64H24 "  type="text" size="4" maxlength="4" style="ime-mode: disabled;">
<img id="captchaImg" name="captchaImg" style="border:1px #000000 solid;cursor:pointer;" width="100" height="30" src="/mall-web/Captcha?configKey=ZJ2t2ofiM9Ikpv4JE8Dctg%3D%3D" alt="请输入验证码" />
<a id="changeVerifyCode" name="changeVerifyCode" style="cursor: pointer;cursor:hand;" class="fontC36cS12">换一张</a>
<input type="hidden" name="configKey" value="ZJ2t2ofiM9Ikpv4JE8Dctg==" />
网页js:
<script>
;document.domain = "10010.com";
$(function(){
    $("#toCheckCaptcha").click(function(){
         var params ={};
         params.inputCode = $('#inputCode').val();
         params.configKey ="ZJ2t2ofiM9Ikpv4JE8Dctg==";
         $.ajax({
            url: '/mall-web/OlympicActivityCaptcha/check',
            type: 'POST',
            data: params, 
            async: false,
            success:function (jsonVerErr){
               var errMsgContent = jsonVerErr.captchaResult;
               if(errMsgContent == undefined || errMsgContent == ""){
                $('#windownbg', window.parent.document).hide();
                $('#windown-box', window.parent.document).hide();
               }else if($.trim(errMsgContent)!= ""){
                    $("#verEssMsg").text("验证码输入错误");
                    $("#verificationError").show();
                    $('#changeVerifyCode').click();
                    return false;
               }
            }
        });
    })
})
</script>


HttpWebRequest请求:

string postData = "inputCode="+this.textBox3.Text;//验证码
            postData += ("&configKey=ZJ2t2ofiM9Ikpv4JE8Dctg==");
         
            request =
       (HttpWebRequest)WebRequest.Create("http://www.10010.com/mall-web/OlympicActivityCaptcha/check");