File.Move() using different credentials?

A

Andy Klare

I am looking for a way to copy a file from a local drive on the server to a
network share but I need to authenticate as a user that has access to the
network share. How can I tie a different set of credentials to the
File.Move()? I can add an Impersonate tag with domain,Username, and
Password to the web.config to get the code to work on my machine as myself
but I think I will have problems when I deploy to a server that does not
have my account as an administrator on it. I would like to simply build a
NetworkCredential object and tie it to the File.Move() call but that does
not appear to be an option.

Does anyone have a example of this? It seems like a fairly simple task but
I am not finding much.

Any ideas would be most appriciated.
Thanks,
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top