File Access denied exception while uploading a file in the FTP Server

I am developing an application which will be used to upload the user files in to a FTP server.
Files are getting uploaded from the developer system to the server without raising any exception
Application is developed in asp.net 2.0 and hosted in a windows 2003 server, am attaching the code.
While uploading a file from the client system, fallowing exception is raised.

System.UnauthorizedAccessException: Access to the path 'C:\Documents and Settings\kb\Desktop\ddddddd.ppt' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at System.Net.WebClient.OpenFileInternal(Boolean needsHeaderAndBoundary, String fileName, FileStream& fs, Byte[]& buffer, Byte[]& formHeaderBytes, Byte[]& boundaryBytes)
   at System.Net.WebClient.UploadFile(Uri address, String method, String fileName)
 Class:EMLC_AddTopic;Method:FileUpload
string strFTPURL = ConfigurationManager.AppSettings["FTPURL"];
string strFTPUserName = ConfigurationManager.AppSettings["FTPUserName"];
string strFTPPassword = ConfigurationManager.AppSettings["FTPPassword"];
System.Net.WebClient ftpClient = new System.Net.WebClient();
System.Net.NetworkCredential ftpCredentials = new System.Net.NetworkCredential(strFTPUserName, strFTPPassword);
ftpClient.Credentials = ftpCredentials;                
ftpClient.Proxy = null;
ftpClient.UploadFile(strFTPURL + strFileName, strSelectedFile);

Open in new window

praneethkavulaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

snowalpsCommented:
The client system does not have sufficient rights for aspnet to access the folder that contains the file to be uploaded.
try giving the same permissions (add "aspnet" to the security on the folder) that are present on the development server.
also are you sure the path is the same on the development server? i.e 'C:\Documents and Settings\kb\Desktop' ??? (except for the profile name i.e kb)

i doubt that!
cross check and let me know.
0
praneethkavulaAuthor Commented:
Snowalps,
My Ftp server have ASP.net installed in it, and the ASPNET account have full control on the FTP folder.
and ASPNET account has full access on the Web Application folder in deployment server.
Eg.
string strFTPURL = "ftp://ftpserverIP/Uploads/";
Client selected the file from the file upload control is
"C:\Documents and Settings\kb\Desktop\ddddddd.ppt"
am changing the strFileName to
strFileName = "ddddddd.ppt"; using strFileName = Path.GetFileName(fuUploadFile.PostedFile.FileName);

so the destination file would be ftp://ftpserverIP/Uploads/ddddddd.ppt
and the source is "C:\Documents and Settings\kb\Desktop\ddddddd.ppt"

This application is live on internet so my client needs file uploading can be done from any where, so how can i set permissions on the client system.

0
snowalpsCommented:
is your application running under a specific account? try to get the user to upload the file from another location say from another drive.does it upload then? check your impersonation in configuration file.
try restarting your IIS once and check again. also, which permissions presently exist on the ftp?
0
praneethkavulaAuthor Commented:
ssssssssssss
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.