Age: 1682 
Date: Fri, 10 Jul 2009 14:45:12 GMT
Connection: Keep-Alive
Via: N2.SJC1: 102
ETag: "0a61a4759d6c61:b2f"
Content-Length: 1091
Content-Type: image/gif
Last-Modified: Tue, 12 Sep 2006 10:50:36 GMT
Accept-Ranges: bytes
Server: Microsoft-IIS/6.0
Vary: Accept-Encoding HttpWebRequest test
test.ContentType........
test.Headers........
........
~(^@^)~

解决方案 »

  1.   

    HttpWebRequest限制太多太烦...
    个人推荐用WinHttp.
      

  2.   

    httpwebrequest 使用简单,但有各种各样限制写不出功能变态的东西来
      

  3.   

    直接用 socket 自由一些,
    调用那个天气预报 web service 的例子:      string requestHeader = null;
          string requestBody = null;
          requestBody = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"
                      + "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n"
                      + "  <soap:Body>\r\n"
                      + "    <getWeatherbyCityName xmlns=\"http://WebXml.com.cn/\">\r\n"
                      + "      <theCityName>" + areaCode + "</theCityName>\r\n"
                      + "    </getWeatherbyCityName>\r\n"
                      + "  </soap:Body>\r\n"
                      + "</soap:Envelope>";
          requestHeader = "POST /WebServices/WeatherWebService.asmx HTTP/1.1\r\n"
                      + "Host: www.webxml.com.cn\r\n"
                      + "Content-Type: text/xml; charset=utf-8\r\n"
                      + "Content-Length: " + requestBody.Length + "\r\n"
                      + "SOAPAction: \"http://WebXml.com.cn/getWeatherbyCityName\"\r\n"
                      + "Connection: Close\r\n\r\n";
          string request = requestHeader + requestBody;
          _hevt_socket_closed.Reset();
          _rcv_buff = "";
          _proxy.Send(_remoteHost, _remotePort, request);
      

  4.   

    HttpWebRequest test .....
    标头加入到Headers集合中
    test.Headers.Add(name,value);
    ..............有些标头名称直接为HttpWebRequest属性.直接赋值即可!
      

  5.   

    webrequest.headers.add
    webrequset.headers["名称"]="值"