2
I am creating a program that communicates with a webapi and is giving me this error in creating the header.
I’m using this to create the header :
var tempo = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ");
var httpWebRequest = (HttpWebRequest)WebRequest.Create("teste");
httpWebRequest.Headers.Add("Date"+ tempo);
The output is this :
Date 2017-09-08T15:25:53Z
I wish it was this:
Date: 2017-09-08T15:25:53Z
I have also tested the following code:
httpWebRequest.Headers.Add($"Date: {DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ")}");
This code generated the following error :
System.Argumentexception: 'Date header has to be modified with the appropriate property or method.'
How do I only show the Date: + time
– Pedro Azevedo
Without appearing the brings the Meuheader
– Pedro Azevedo
As far as I know the header must have a name, just be careful with the name you give, there are some patterns to follow otherwise the firewall may end up ignoring it.
– Gabriel Coletta
I wanted my header to look like this for example : 'Date: 2016-06-29T12:00:00Z'
– Pedro Azevedo