HttpWebRequest头部可用设置以及可读设置
来源:互联网 发布:我的世界自动瞄准js 编辑:程序博客网 时间:2024/06/11 03:56
注意:这是在Silverlight 1.1 Alpha中粗略测试的结果,如有错误,欢迎指正!
Alpha还是Alpha,连HttpWebRequest都这么不成熟,最常用的timeout属性居然既不能设置也不能更改,实在是郁闷!花了点时间,把所有的属性的读和写都测试了一遍。
能写的属性如下(其中被注释的表示不能写):
能读的属性如下(其中被注释的表示不能读):
Alpha还是Alpha,连HttpWebRequest都这么不成熟,最常用的timeout属性居然既不能设置也不能更改,实在是郁闷!花了点时间,把所有的属性的读和写都测试了一遍。
能写的属性如下(其中被注释的表示不能写):
引用内容:
request.Accept = "text/*";
//request.Address.ToString(); readonly
//request.AllowAutoRedirect = true;
//request.AllowWriteStreamBuffering = true;
//request.AutomaticDecompression
request.Connection = "Close";
request.ContentLength = 256;
request.ContentType = "text/xml";
request.Expect = "100-Continue";
//request.HaveResponse.ToString(); readonly
request.Headers["Accept-Language"] = "zh-cn";
//request.KeepAlive = false;
//request.MediaType = "text/html";
request.Method = "POST";
//request.Pipelined = true;
//request.PreAuthenticate = true;
//request.ProtocolVersion = HttpVersion.Version10;
//request.ReadWriteTimeout = 10 * 1000;
request.Referer = "http://www.ooboy.net";
//request.RequestUri.ToString(); readonly
//request.SendChunked = true;
//request.Timeout = 10 * 1000;
request.TransferEncoding = "UTF-8";
//request.UserAgent = "Test Client";
//request.Address.ToString(); readonly
//request.AllowAutoRedirect = true;
//request.AllowWriteStreamBuffering = true;
//request.AutomaticDecompression
request.Connection = "Close";
request.ContentLength = 256;
request.ContentType = "text/xml";
request.Expect = "100-Continue";
//request.HaveResponse.ToString(); readonly
request.Headers["Accept-Language"] = "zh-cn";
//request.KeepAlive = false;
//request.MediaType = "text/html";
request.Method = "POST";
//request.Pipelined = true;
//request.PreAuthenticate = true;
//request.ProtocolVersion = HttpVersion.Version10;
//request.ReadWriteTimeout = 10 * 1000;
request.Referer = "http://www.ooboy.net";
//request.RequestUri.ToString(); readonly
//request.SendChunked = true;
//request.Timeout = 10 * 1000;
request.TransferEncoding = "UTF-8";
//request.UserAgent = "Test Client";
能读的属性如下(其中被注释的表示不能读):
引用内容:
testInfo.Text = "Accept: " + request.Accept;
testInfo.Text += "/nAddress: " + request.Address.ToString();
testInfo.Text += "/nAllowAutoRedirect: " + request.AllowAutoRedirect.ToString();
testInfo.Text += "/nAllowWriteStreamBuffering: " + request.AllowWriteStreamBuffering.ToString();
testInfo.Text += "/nAutomaticDecompression: " + request.AutomaticDecompression.ToString();
testInfo.Text += "/nConnection: " + request.Connection;
testInfo.Text += "/nContentLength: " + request.ContentLength.ToString(); //设置后才可读
testInfo.Text += "/nContentType: " + request.ContentType;
testInfo.Text += "/nExpect: " + request.Expect;
testInfo.Text += "/nHaveResponse: " + request.HaveResponse.ToString();
testInfo.Text += "/nHeaders: " + request.Headers["Accept-Language"];
//testInfo.Text += "/nKeepAlive: " + request.KeepAlive.ToString();
//testInfo.Text += "/nMediaType: " + request.MediaType;
testInfo.Text += "/nMethod: " + request.Method;
//testInfo.Text += "/nPipelined: " + request.Pipelined.ToString();
//testInfo.Text += "/nPreAuthenticate: " + request.PreAuthenticate.ToString();
//testInfo.Text += "/nProtocolVersion: " + request.ProtocolVersion.ToString();
//testInfo.Text += "/nReadWriteTimeout: " + request.ReadWriteTimeout.ToString();
testInfo.Text += "/nReferer: " + request.Referer;
testInfo.Text += "/nRequestUri: " + request.RequestUri.ToString();
//testInfo.Text += "/nSendChunked: " + request.SendChunked.ToString();
//testInfo.Text += "/nTimeout: " + request.Timeout.ToString();
testInfo.Text += "/nTransferEncoding: " + request.TransferEncoding;
testInfo.Text += "/nUserAgent: " + request.UserAgent;
testInfo.Text += "/nAddress: " + request.Address.ToString();
testInfo.Text += "/nAllowAutoRedirect: " + request.AllowAutoRedirect.ToString();
testInfo.Text += "/nAllowWriteStreamBuffering: " + request.AllowWriteStreamBuffering.ToString();
testInfo.Text += "/nAutomaticDecompression: " + request.AutomaticDecompression.ToString();
testInfo.Text += "/nConnection: " + request.Connection;
testInfo.Text += "/nContentLength: " + request.ContentLength.ToString(); //设置后才可读
testInfo.Text += "/nContentType: " + request.ContentType;
testInfo.Text += "/nExpect: " + request.Expect;
testInfo.Text += "/nHaveResponse: " + request.HaveResponse.ToString();
testInfo.Text += "/nHeaders: " + request.Headers["Accept-Language"];
//testInfo.Text += "/nKeepAlive: " + request.KeepAlive.ToString();
//testInfo.Text += "/nMediaType: " + request.MediaType;
testInfo.Text += "/nMethod: " + request.Method;
//testInfo.Text += "/nPipelined: " + request.Pipelined.ToString();
//testInfo.Text += "/nPreAuthenticate: " + request.PreAuthenticate.ToString();
//testInfo.Text += "/nProtocolVersion: " + request.ProtocolVersion.ToString();
//testInfo.Text += "/nReadWriteTimeout: " + request.ReadWriteTimeout.ToString();
testInfo.Text += "/nReferer: " + request.Referer;
testInfo.Text += "/nRequestUri: " + request.RequestUri.ToString();
//testInfo.Text += "/nSendChunked: " + request.SendChunked.ToString();
//testInfo.Text += "/nTimeout: " + request.Timeout.ToString();
testInfo.Text += "/nTransferEncoding: " + request.TransferEncoding;
testInfo.Text += "/nUserAgent: " + request.UserAgent;
原文地址:http://ooboy.net/blog/blogview.asp?logID=491&cateID=12
- HttpWebRequest头部可用设置以及可读设置
- easyui设置文本框可读
- jsp页面加入头部以及底部,设置背景
- HttpClient设置头部信息
- 头部 meta 设置
- 浏览器头部兼容设置
- 修改tomcat编码和设置可读写
- 网页头部属性设置技巧
- apache响应报文头部设置
- 设置动画从头部进入
- 设置动画从头部出去
- 设置section的头部间距
- IP报文中的头部设置
- 添加图片设置可用
- jq设置http头部信息和获取头部信息
- Ubuntu 7.10 设置Samba共享可读写文件夹
- 在Ubuntu中设置samba共享可读写文件夹
- 在Ubuntu中设置samba共享可读写文件夹
- oracle
- 开始→运行→输入的命令集锦
- JSP2与JSP1.2比较
- 2007,盘点--收获了什么?
- C#.Net的常见面试试题 [转]
- HttpWebRequest头部可用设置以及可读设置
- 教你如何配置CISCO路由器
- Iframe 详解
- 周期
- HTML 标记总览
- 长方形可用最少正方形来代替
- 常用网络命令
- 如何实现iframe(嵌入式帧)的自适应高度
- c下创建临时文件mkstemp函数