zoukankan      html  css  js  c++  java
  • C# HttpWebRequest 请求返回 The remote server returned an error: (400) Bad Request.

    可以看下他的响应Body

    catch (WebException ex)
                {
                    if (ex.Status == WebExceptionStatus.ProtocolError)
                    {
                        HttpWebResponse err = ex.Response as HttpWebResponse;
                        if (err != null)
                        {
                            string htmlResponse = new StreamReader(err.GetResponseStream()).ReadToEnd();
                            string txtResults = string.Format("{0} {1}", err.StatusDescription, htmlResponse);
                            return txtResults;
                        }
                    }
                    return ex.Message;
                }

  • 相关阅读:
    Android开发环境搭建
    Noi 2016
    [二分图&最小割]
    [BZOJ 3145][Feyat cup 1.5]Str 解题报告
    [动态图]
    [组合数取模][中国剩余定理]
    [BZOJ 4436][Cerc2015]Kernel Knights
    [NOI 2014]做题记录
    [线段树合并]
    [树套树模板]
  • 原文地址:https://www.cnblogs.com/LuoEast/p/14061290.html
Copyright © 2011-2022 走看看