HttpWebRequest bug on 304-cached when 200-ok had missing "Date" response header - by snemarch

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 626833 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 12/2/2010 1:13:46 AM
Access Restriction Public


This is a sneaky issue which requires several parts to trigger:
1) HTTP server that doesn't include a HTTP "Date:" response header.
2) manual construction of HTTP Authorization request header.
3) use of HttpRequestCachePolicy.

If HTTP server is fixed to include a Date, OR request.Credentials is used for authentication, OR request.CachePolicy isn't specified, the bug doesn't trigger. I'm doing manual HTTP Basic Auth to avoid the initial unnecessary 401-Unauthorized server roundtrip.

The bug triggers on the second HttpWebRequest to the server, which gives a 304 Not Modified response - and causes HttpWebRequest to throw an exception istead of serving cached content.

More information at .
Sign in to post a comment.
Posted by snemarch on 1/25/2011 at 3:16 PM
It's an obscure bug, but resolved as "by design"? :-o
Posted by snemarch on 12/11/2010 at 6:00 AM
Yes, but that doesn't get rid of the initial 401 roundtrip - and because of another HttpWebRequest bug (, I have to do the manual Authorization header construction.
Posted by Microsoft on 12/3/2010 at 2:55 PM
Have you instead considered using the PreAuthenticate option to avoid extra 401 round trips?
Posted by Microsoft on 12/2/2010 at 10:28 PM
Thanks for your feedback.
We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 12/2/2010 at 1:21 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(