Access ftp using app pool identity with C#

Y

You Big Dummy

I have a web application that will upload files to ftp. I can succesfully do
this if I specify the credentials using the ftpwebrequest.credentials
property. But the problem is that we won't to be able to have our code use
the identity of the application pool to access the ftp but can't seem to
figure out how as the credentials property only accepts the
networkcredentials class.
 
J

Jeroen Mostert

You said:
I have a web application that will upload files to ftp. I can succesfully do
this if I specify the credentials using the ftpwebrequest.credentials
property. But the problem is that we won't to be able to have our code use
the identity of the application pool to access the ftp but can't seem to
figure out how as the credentials property only accepts the
networkcredentials class.

That's because FTP doesn't support integrated authentication, so you can't
use a Windows identity to authenticate. FTP uses only plaintext passwords
and you don't have access to the password of a Windows identity.

If the FTP server is in your domain, it would be a better idea not to use
FTP at all and copy files directly over the network. A robust way of doing
this is provided by the Robocopy utility.

If the FTP server is not in your domain, you should not have a Windows
account whose credentials match that of one on the FTP server. A cracker
could use a successful attack on the FTP server to compromise your domain.
Store the FTP credentials somewhere safe instead -- the web.config with
encryption is probably sufficient.
 

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

Top