Upload file with ftp on server

Posted on 2011-10-09
Last Modified: 2012-05-12
In my 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());
                        ftpWebRequest.ContentLength = fileContents.Length;

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

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=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

I also tried
<location allowOverride="false">
      <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
Question by:ziorinfo
    LVL 9

    Expert Comment

    you have to give write permission to the user that uses processes for that folder.

    Author Comment

    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.
    LVL 9

    Accepted Solution

    maybe you should contact their support and ask them to give write permission to that folder for worker process.
    or you may change it from the control panel.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now