Posted on: 11/23/2013 1:26:16 AM | Views : 820

I want to save data collected on a webform to a text file on my ftp site. When running on the localhost, the process works perfectly every time but when running from the internet website I receive an error every time:
Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
This is my code. What am I doing wrong?
Thanks! 
SaveFileName = “ftp path”
Dim myFtpWebRequest As FtpWebRequest
Dim myFtpWebResponse As FtpWebResponse
Dim myStreamWriter As StreamWriter
 
myFtpWebRequest = WebRequest.Create(SaveFileName) 
myFtpWebRequest.Credentials = New NetworkCredential("userid", "Password") 
myFtpWebRequest.Method = WebRequestMethods.Ftp.UploadFile
myFtpWebRequest.UseBinary = True 
myStreamWriter = New StreamWriter(myFtpWebRequest.GetRequestStream())

Go to the complete details ...