How to get LastModified date of the HttpWebResponse in c#?

1.2k views Asked by At

I am trying to create a cache of images for windows phone 8.1. To do this I need to read the property LastModified of HttpWebRequest. I searched google and I found this, does not work. I have this code:

        HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(imageFileUri);
        webRequest.Method="HEAD";
        HttpWebResponse webResponse =  ((HttpWebResponse)await webRequest.GetResponseAsync());

What I have to do to get the date?

1

There are 1 answers

0
own3dh2so4 On

Debugging found the solution:

 var Date = myHttpWebResponse.Headers["Last-Modified"];

This return a String like:

     "Mon, 01 Dec 2014 20:00:31 GMT"