C#httpClient发送一些LiteWeb服务器无法处理的响应?

时间:2016-02-09 23:05:13

标签: c# cookies dotnet-httpclient

我读了一个外部网页,通过C#自动化它 我在Apache HttpClient

的Adroid应用程序中也是这样做的

在C#中使用HttpClientHttpWebRequest当我想使用cookie容器时,服务器会出现500内部错误和一般通道,如“一般故障联系管理员”

请求标头类似(我知道因为我的previus aplication,不需要Accept编码,User-Agent,等等。)

C#发送此内容并且不起作用:

POST /index.php/user/login HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: www.portal.nauta.co.cu
Cookie: session=c5m1a4hi0vdf4t8h42eoep16k0; nauta_lang=60deb6d2a886bafa100bcb54c798900d7d72e4f7%7Ees-es
Content-Length: 117
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

login_user=user&password_user=pass&tmptxt=89l4&btn_submit=Aceptar&action=checkdata&redirect=

这项工作:

POST /index.php/user/login/es-es HTTP/1.1
Host: www.portal.nauta.co.cu
User-Agent: Mozilla/5.0 (Windows NT 6.2; rv:44.0) Gecko/20100101 Firefox/44.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
DNT: 1
Referer: https://www.portal.nauta.co.cu/index.php/user/login/es-es
Cookie: session=s26mr82dgmvbu2686vg16cb9k4; nauta_lang=3cd710098dbb2fc05822b19c9b44eab89dc7767f%7Ees-es
Connection: keep-alive

login_user=user&password_user=pass&tmptxt=89l4&btn_submit=Aceptar&action=checkdata&redirect=

错误不仅仅提供了太多信息: 服务器:LiteWeb服务器mod_perl / 2.0.4 Perl / v5.10.1 X-Powered-By:PHP / 5.3.3 并使用kohana php框架

我希望有一个错误这个服务器,没有抱怨100%extandar的所有变种或C#发送稀有线endinds,问题是特别发送时发送cookie 连接是HTTPS并使用PROXY,但它适用于其他请求而没有问题

这是错误的响应标头:

response.Headers    {Pragma: no-cache
Cache-Control: no-store, must-revalidate, no-cache, post-check=0, pre-check=0
Date: Tue, 09 Feb 2016 22:34:22 GMT
Set-Cookie: nauta_lang=36a3420dd5897c93ba24f1ecd832057694c63a6d%7E; expires=Mon, 08-Feb-2016 22:34:22 GMT; path=/, nauta_lang=60deb6d2a886bafa100bcb54c798900d7d72e4f7%7Ees-es; path=/
Server: LiteWeb Server mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.3
Connection: close
}

错误的主体:

<html><head><style type="text/css">
        #kohana_error { background: #ddd; font-size: 1em; font-family:sans-serif; text-align: left; color: #111; }
        #kohana_error h1,
        #kohana_error h2 { margin: 0; padding: 1em; font-size: 1em; font-weight: normal; background: #911; color: #fff; }
        #kohana_error h1 a,
        #kohana_error h2 a { color: #fff; }
        #kohana_error h2 { background: #222; }
        #kohana_error h3 { margin: 0; padding: 0.4em 0 0; font-size: 1em; font-weight: normal; }
        #kohana_error p { margin: 0; padding: 0.2em 0; }
        #kohana_error a { color: #1b323b; }
        #kohana_error pre { overflow: auto; white-space: pre-wrap; }
        #kohana_error table { width: 100%; display: block; margin: 0 0 0.4em; padding: 0; border-collapse: collapse; background: #fff; }
        #kohana_error table td { border: solid 1px #ddd; text-align: left; vertical-align: top; padding: 0.4em; }
        #kohana_error div.content { padding: 0.4em 1em 1em; overflow: hidden; }
        #kohana_error pre.source { margin: 0 0 1em; padding: 0.4em; background: #fff; border: dotted 1px #b7c680; line-height: 1.2em; }
        #kohana_error pre.source span.line { display: block; }
        #kohana_error pre.source span.highlight { background: #f0eb96; }
        #kohana_error pre.source span.line span.number { color: #666; }
        #kohana_error ol.trace { display: block; margin: 0 0 0 2em; padding: 0; list-style: decimal; }
        #kohana_error ol.trace li { margin: 0; padding: 0; }
        .js .collapsed { display: none; }
    </style>
    </head><body><div id="kohana_error">
        <h1>Ha ourrido un error</h1>
        <p>Error general del sistema. Por favor contacte al administrador</p>
            </div>
    </body></html>

0 个答案:

没有答案