I'm uploading an image from my aspx page to a folder(not in database) in ftp server using the following code::
System.IO.FileStream newFile
= new System.IO.FileStream(Server.MapPath(sSavePath + sFilename),System.IO.FileMode.Create,FileAccess.ReadWrite, FileShare.ReadWrite);
newFile.Write(myData, 0, myData.Length);
I'm using a fileupload control to select an image.
now, when i'm running this page from my local server, and click the save button...the selected image is being stored in the webserver.
but, when i hosted this page, run from the web server, select an image and click the save button, a popup window asking for ftp username and pasword is appearing.
Now, what my question is, how to pass the login credentials to the ftp server through my code.
thanks in advance...
2007-07-31
20:08:29
·
1 answers
·
asked by
quest_.net
1
in
Computers & Internet
➔ Programming & Design
Please note that i dont want to use this kind of code::
string ftpurl = "ftp:////";
HttpPostedFile myFile = fileupload.PostedFile;
string sFilename = System.IO.Path.GetFileName(myFile.FileName);
string fname = ftpurl + sFilename;
WebClient mywebclient = new WebClient();
mywebclient.Credentials = new NetworkCredential("username", "password");
mywebclient.UploadFile(fname.ToString(),myFile.FileName.ToString());
(and i dont want to use any third party components)
Could anyone please help me and tell me how to pass the ftp login credentials through my code.
thanks in advance..
2007-07-31
20:09:25 ·
update #1