Upload file with ftp on server

In my asp.net C# web application i am using telerik upload control to upload the image or file on server with ftp.
My Code is as follows:
ftpfilepath = AppFunctions.GetFTPUrl() + AppFunctions.GetFileUploadPath() + filename;
                        ftpWebRequest = (FtpWebRequest)WebRequest.Create(ftpfilepath);
                        ftpWebRequest.Method = WebRequestMethods.Ftp.UploadFile;
                        ftpWebRequest = AppFunctions.GetNetworkCredentials(ref ftpWebRequest);
                        streamReader = new StreamReader(uploadedFile.InputStream);
                        byte[] fileContents = Encoding.UTF8.GetBytes(streamReader.ReadToEnd());
                        streamReader.Close();
                        ftpWebRequest.ContentLength = fileContents.Length;

                        stream = ftpWebRequest.GetRequestStream();
                        stream.Write(fileContents, 0, fileContents.Length);
                        stream.Close();
                        ftpWebResponse = (FtpWebResponse)ftpWebRequest.GetResponse();
                        ftpWebResponse.Close();

When I run it on my local machine, it works fine, but as soon as i uploaded it on the production server, it gives error as :
Error Occured : Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

I also tried
<location allowOverride="false">
  <system.web>      
      <trust level="Full" originUrl=""/>

but then it gives error as :
Error Message: This configuration section cannot be used at this path. This happens when the site administrator has locked access to this section using <location allowOverride="false"> from an inherited configuration file.

Please advice
ziorinfoAsked:
Who is Participating?
 
jkofteConnect With a Mentor Commented:
maybe you should contact their support and ask them to give write permission to that folder for asp.net worker process.
or you may change it from the control panel.
0
 
jkofteCommented:
you have to give write permission to the user that uses asp.net processes for that folder.
0
 
ziorinfoAuthor Commented:
Thanks jkofte,

The problem is we are using Godaddy for website hosting and as per server administrator there is no iis user to give permission to the folder.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.