Search

HttpWebRequest request.Date Not Does not honor string format by lwoodb

Resolved
as By Design Help for as By Design

1
0
Sign in
to vote
Type: Bug
ID: 776389
Opened: 1/11/2013 5:27:45 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
The HttpWebRequest request.Date header can be only get modified in .NET Framework 4 and according to the documentation, the System.Net namespace will always write this header as standard form using GMT (UTC) format. So, whatever you can do to format your date as you want, won't work!

In other .NET framework versions you won't be able to modify the HttpWebRequest request.Date header because it will use the actual date in correct GMT (UTC) format unless you use a kind of hack to set your own date and format

Full detail here
http://stackoverflow.com/questions/11497177/c-sharp-httpwebrequest-date-header-formatting
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

.NET Framework 4.0

Steps to reproduce

string pattern = "ddd, dd MMM yyyy HH:mm:ss -0000";
request.Date = DateTime.ParseExact("Mon, 16 Jul 2012 01:16:18 -0000", pattern, null);
But, when I look at the headers of the request, here's what I get:

request.Headers.Get("Date");
// "Mon, 16 Jul 2012 07:16:18 GMT"

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results




request.Headers.Get("Date");
// "Mon, 16 Jul 2012 07:16:18 GMT"

Expected results

string pattern = "ddd, dd MMM yyyy HH:mm:ss -0000";
request.Date = DateTime.ParseExact("Mon, 16 Jul 2012 01:16:18 -0000", pattern, null);
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 1/13/2013 at 11:16 PM
Thanks for your feedback.

We are rerouting 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 1/11/2013 at 5:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.