<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>HttpWebRequest and Expect 100 Continue</title><link>http://blogs.msdn.com/joncole/archive/2005/09/08/462659.aspx</link><description>How do the ServicePointManager.Expect100Continue and ServicePoint.Expect100Continue properties change the behavior of my HttpWebRequest? This is a question that seems to come up from time to time and I thought I would give a little more information. First,</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: HttpWebRequest and Expect 100 Continue</title><link>http://blogs.msdn.com/joncole/archive/2005/09/08/462659.aspx#638765</link><pubDate>Tue, 20 Jun 2006 10:37:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:638765</guid><dc:creator>Serge</dc:creator><description>Whats the best way to handle retrie's using HttpWebRequest? HttpWebRequest does not seem to offer any native mechanisms.&lt;br&gt;&lt;br&gt;Serge</description></item><item><title>re: HttpWebRequest and Expect 100 Continue</title><link>http://blogs.msdn.com/joncole/archive/2005/09/08/462659.aspx#640584</link><pubDate>Wed, 21 Jun 2006 02:27:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:640584</guid><dc:creator>joncole</dc:creator><description>There are some limited times when HttpWebRequest will automatically retry a request but there are many times when it will not because it doesn't know a resubmitted request will affect the state of web application receiving the request. &amp;nbsp;Consider a Banking application that communicates over the network. &amp;nbsp;If HttpWebRequest were to retry requests automatically, then it could potentially mess up the state of the bank account. &amp;nbsp;Now, realistically, a banking application should have safeguards against such a problem, but HttpWebRequest can't really make that assumption.&lt;br&gt;&lt;br&gt;Admittedly, HttpWebRequest could potentially provide some API that would allow a developer to tell it to go ahead and retry a request, but that functionality is not currently supported (I will suggest it to the System.Net team).&lt;br&gt;&lt;br&gt;As for your need to handle retries with currently released versions of the product, you should submit your request and when an error occurs you will need to inspect the error and decide which types of errors are fatal and which ones are not fatal in the context of your application. &amp;nbsp;You will also need to implement some type of max retry count logic as it is possible that you could get into some type of infinite failure/retry loop otherwise. &amp;nbsp;When deciding what failures are non-fatal, I would look at the WebException.Status property to figure out what type of error occured. &amp;nbsp;A description of the possible values can be found at &lt;a rel="nofollow" target="_new" href="http://msdn2.microsoft.com/en-us/system.net.webexceptionstatus.aspx"&gt;http://msdn2.microsoft.com/en-us/system.net.webexceptionstatus.aspx&lt;/a&gt;.</description></item><item><title>re: HttpWebRequest and Expect 100 Continue</title><link>http://blogs.msdn.com/joncole/archive/2005/09/08/462659.aspx#643015</link><pubDate>Thu, 22 Jun 2006 19:50:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:643015</guid><dc:creator>ryan</dc:creator><description>Thanks for the post. I'm a C# newbie. I'm trying to send the request body after reading the server response using 100-Continue. I want my application to either follow a redirect if that is returned from the server, or send the body if a 100 Continue is recieved, but it's not obvious to me how to send the body after checking the headers.&lt;br&gt;&lt;br&gt;resp = (req.GetResponse() as HttpWebResponse);&lt;br&gt;&lt;br&gt;Seems to hang if a 100 Continue is sent back from the server. (confirmed with packet sniffer)&lt;br&gt;&lt;br&gt;I'm sure I'm missing something. Thanks in advance.&lt;br&gt;&lt;br&gt;ryan</description></item><item><title>re: HttpWebRequest and Expect 100 Continue</title><link>http://blogs.msdn.com/joncole/archive/2005/09/08/462659.aspx#647851</link><pubDate>Tue, 27 Jun 2006 00:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:647851</guid><dc:creator>joncole</dc:creator><description>The first thing I would tell you (and anyone else reading this) is that questions like this are typically better directed to the msdn forums (&lt;a rel="nofollow" target="_new" href="http://forums.microsoft.com/msdn/"&gt;http://forums.microsoft.com/msdn/&lt;/a&gt;) because I don't always get around to reading comments on my blogs and they may go unanswered for a while. &amp;nbsp;&lt;br&gt;&lt;br&gt;To try to answer your question, I would ask for some more code from you. &amp;nbsp;The most common cause of this behavior is that the request stream (returned by GetRequestStream()) is not being closed. &amp;nbsp;As a general rule, you should always close any HttpResponse objects and streams that are associated with your request/response. &amp;nbsp;Doing this signals the underlying objects that things should move along to the next stage in the process. &amp;nbsp;&lt;br&gt;&lt;br&gt;As for your question on redirects and uploads, keep in mind that some types of redirection can cause POST requests to be turned into GET requests. &amp;nbsp;If you are getting back anything other than a 307 status code when the redirection occurs, then you should consider turning off automatic redirection on HttpWebRequest and handle the redirection yourself.</description></item><item><title>Protocol Violation Errors using the IDK under ALUI 6.5</title><link>http://blogs.msdn.com/joncole/archive/2005/09/08/462659.aspx#8415749</link><pubDate>Tue, 22 Apr 2008 03:38:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8415749</guid><dc:creator>Welcome to .NET Portlets</dc:creator><description>&lt;p&gt;So I recently encountered an error message I hadn't previously seen while developing with the IDK: The server committed a protocol violation. Section=ResponseStatusLine Description: An unhandled exception occurred during the execution of the current web&lt;/p&gt;
</description></item></channel></rss>