Search code examples
asp.netfile-uploadnetwork-programmingacl

Asp.net APP - Handle File storage on another computer


All,

I have an asp.net (asp.net 2.0) application that allows users to attach (upload) files to records (not much different from typical e-mail client) and then view those attached files later.

Typically, we will store these files on the webserver (i.e. on the same machine in app's directory or in another drive on the same computer). But, ... some of our client's would like to store these files on another computer (their designated file server that doesn't run our asp.net app) and here where the problem is: Since our application runs typically another Network Service account it will not have permissions to a directory on another machine.

The million dollar question is: For this type of setup, what are best options to make this setup work? I have listed some below that could elaborated:

1) Keep the files on the same machine as the app and tell client to use backup software to copy it to the file server at the end of the day (not really real-time)

2) Setup a share on the file server but ... how do I deal w/ security,- in other words, network service account is not privileged enough to copy files to shared folder. Do I?

2a) Run my app-pool w/ more powerful account?

2b) Is this possible? If yes, how to:- Use .net code to change current thread's SID to a more powerful account, copy file, and the switch back to network service.

Another issue with #2 is domain networks where policies are on the domain controller and require additional setup.

3) Other solutions????


Solution

  • I decided to use impersonation for directories that require user logon permissions. Here's a good reference material:

    http://support2.microsoft.com/?id=306158

    This solution works very well.