own3dh2so4
own3dh2so4

Reputation: 401

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

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?

Upvotes: 1

Views: 1245

Answers (1)

own3dh2so4
own3dh2so4

Reputation: 401

Debugging found the solution:

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

This return a String like:

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

Upvotes: 1

Related Questions