I am using FileSystemWatcher
class in a console application, for Encrypting files within the directory.so that if i paste/create a file inside the directory the FileSystemWatcher
will detect it and hence it is encrypted using suitable function call. so that i can did the encryption without affecting the normal work flow.
Now my question is that, How can i detect http:
request to any of the files inside the watcher
so that i can decrypt the file through a parallel console application. is there any possibility to do like this?
Using a parallel console application for decrypting
is probably not the best thing to do (why a console application? A service seems more suitable), but you can monitor any HTTP request to a certain directory using IIS
or another web server.
No HTTP requests will be served unless the server has been set up as (some kind of) web server, in which case decryption can be done upon arrival of requests. In IIS
this is the HttpRequestHandler
.
This won't add extra security though, if that is your aim. A file send over HTTP that is decrypted prior to sending over the wire can eavesdropped by a man-in-the-middle attack. If you want to protect your file and have stronger security than SSL and secure authentication, you should send the files encrypted and have the clients decrypt them locally (this approach is used, for instance, when you download software or movies from some companies).