0

我正在嘗試爲windows phone 8.1創建圖像緩存。爲此,我需要閱讀HttpWebRequest屬性LastModified。我搜索谷歌,我發現this,不起作用。我有這樣的代碼:如何獲取C#中HttpWebResponse的LastModified日期?

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

我該怎麼做才能得到日期?

回答

0

調試找到了解決辦法:

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

這返回一個字符串,如:

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