注意:这是在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.fdream.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;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.