0

I am facing a problem regarding when a file open at physically end then i will get information that file open or not (File like as .xml , .txt).

So how to get information regarding this file .

I am awaiting for a positive response.

Thanks,

Sanwar.

sanwar
  • 1
  • Related thread : http://stackoverflow.com/questions/876473/is-there-a-way-to-check-if-a-file-is-in-use – KV Prajapati Jul 02 '12 at 13:09
  • Please clearify your question... What do you mean by physical end? Do you mean if we can determine from server side if the user's browser has opened the file which may be .xml .txt etc? – mortb Jul 02 '12 at 13:10

1 Answers1

0

If the file is located within the directory structure of your ASP.NET website then you can use Server.MapPath to get the file location on disk. Here's a working example:

var file = new FileInfo(Server.MapPath("~/SomeFolder/SomeFile.txt"));

If your file is not located within the web site then you will need to have the website call a self hosted WCF service that will have the appropriate security permissions to access the file and return the file information via a DataContract

Kane
  • 16,471
  • 11
  • 61
  • 86