'Get meta data of a file using c#

I need to find a files's meta data using c#.The file i use is saved in third party site. I can able to download the file from that server but i can't able to get the original meta data of the file that i downloaded. How to achieve this using c#.Below is my code.

string FilePath = AppDomain.CurrentDomain.BaseDirectory + @"Downloads\";
            string Url = txtUrl.Text.Trim();
            Uri _Url = new Uri(Url);
            System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(_Url);
            request.Timeout = Timeout.Infinite;
            System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
            response.Close();
            if (response.ContentType != "text/html; charset=UTF-8")
            {
                string FileSize = response.Headers.Get("Content-Length");
                int lastindex = Url.LastIndexOf("/");
                string TempUrlName = Url.Substring(lastindex + 1, Url.Length - (lastindex + 1));

                WebClient oWebClient = new WebClient();
                oWebClient.DownloadFile(txtUrl.Text.Trim(), FilePath + @"\" + TempUrlName);
                if (File.Exists(FilePath + @"\" + TempUrlName))
                {
                    FileInfo oInfo = new FileInfo(FilePath + @"\" + TempUrlName);
                    DateTime time = oInfo.CreationTime;
                    time = oInfo.LastAccessTime;
                    time = oInfo.LastWriteTime;
                }
            }

I can able to get file size,creation time,last accessed time and last write time only after saving the file in local. But i need the file meta data infos when file is located in server using c#.

Thanks



Solution 1:[1]

Since those are properties stored in the file system and changed once you save them locally, you won't be able to access those via HTTP.

Do you have any influence on the third party? Maybe have them send those properties along in the headers?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alexander