tags:

views:

12

answers:

2

I have a scenario in my mind .. I need validations/suggestions from Stack over flow !! :) There is a (remote)apache server hosting this URL "http://someserver.com/logs/log.txt:4041" .When i hit this URL in IE it opens a page containing log.txt in a file-folder-directory structure (after authentication). Is there any way to get the attributes of the log.txt (attributes what i mean is file creation date,file modification date,file size etc..).

What I am planning to do is to write a code in C#.net(in the client) using system.IO namespace and using the fileinfo class and use FileInfo fi = new FileInfo(pathname); fi.CreationTime.toString() to retrieve the file creation time.

This is successful for files that exists in local directories in my hard drive!! . Is it possible to use the same code for retrieving the information about the file that exists in the server that is accessed using the URL "http://someserver.com/logs/log.txt:4041" ?? if yes should i give the URL in my pathename ? Take it for granted that i have access to the server by authentication..

A: 

You can try to inspect the data in WebResponse.Headers. The web server will send some date/time information of the file with the response. This may however not be what you expect depending on the web server you're calling and whether the page you are loading is a script or a file on disk. Settings of the web server will also influence the details returned.

Pieter
@Pieter : its a file on the disk and the folders can be navigated to parent directories.I will try with the WebResponse.Headers and get you back :) ASAP !!
vmani007
A: 

You will not be able to use FileInfo method for items retrieved from http. However if the directory that the file that you are getting served to you is accessible from a share of from samba you could use this method.

rerun
@rerun thanks for the info :)
vmani007