Fdream's Blog
专注于WEB前端开发
Powered by Google

HttpWebRequest头部可用设置以及可读设置

22 多云 2007-10
Fdream 发表于 Silverlight, 已被阅读 14870 次, 评论 0 条
关键词:Silverlight
[ 阅读字体大小: ]

注意:这是在Silverlight 1.1 Alpha中粗略测试的结果,如有错误,欢迎指正!

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";

能读的属性如下(其中被注释的表示不能读):

引用内容:

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;

Related articles 您可能对这些文章也感兴趣:
Related comments 与该文相关的评论:(我也想说几句)
Add a comment 我来说两句: 
禁止表情
禁止UBB
禁止图片
识别链接
识别关键字
表  情
arrow
用户名:   密码:  (匿名可不写) 同时注册?
验证码:   看不清?换个图片  看不清楚?换个图片

 
Copyright © 2005-2008,Fdream All Rights Reserved
Processed in 0.1249984 second(s) , unknow queries
Powered by OWord V0.1, Even Not Alpha
(此博客程序为半成品,请勿索取,以免给您的心灵造成创伤^_^)
鄂ICP备05026031号