uploading files using FTP in asp.net


i am uploading files using ftp in asp.net .i am getting the errot like "unable to connect the remote server".

i am using the code like this



Protected Sub cmdUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdUpload.Click

uploadFileUsingFTP("", "D:\test1.txt")

lblMsg.Text = "File Uploaded Successfully :)"

End Sub


Public Sub uploadFileUsingFTP(ByVal CompleteFTPPath As String, ByVal CompleteLocalPath As String, Optional ByVal UName As String = "", Optional ByVal PWD As String = "")

Dim reqObj As FtpWebRequest = WebRequest.Create(CompleteFTPPath)

reqObj.Method = WebRequestMethods.Ftp.UploadFile

reqObj.Credentials = New NetworkCredential(UName,PWD)

Dim streamObj As FileStream = File.OpenRead(CompleteLocalPath)

Dim buffer(streamObj.Length) As Byte

streamObj.Read(buffer, 0, buffer.Length)


streamObj = Nothing

reqObj.GetRequestStream().Write(buffer, 0, buffer.Length)       //getting error here

reqObj = Nothing

End Sub


plz help me

thanks in advance

1/20/2009 6:15:26 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 38

Why dont you try My Class in VB.Net which has this feature


My.Computer.Network.UploadFile("C:\Data.txt", "", "Username", "Password")


MAKMark as Answer if this reply helps you
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
1/20/2009 7:15:17 AM

 hi mudassarkhan

I would like to have a look at your class for uploading via ftp , I have looked at your blog and your site but cannot find it , could you post a url where I can have a look 


2/5/2009 2:52:53 PM


hi mudassarkhan

I would like to have a look at your class for uploading via ftp , I have looked at your blog and your site but cannot find it , could you post a url where I can have a look 


Actually I recently started my blog and site so I'll definately put.

meanwhile I'll suggest you some examples if you need help let me know


MAKMark as Answer if this reply helps you
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
2/5/2009 3:16:23 PM

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

vb.net web project
Hi All, I have a situation in my web application whereby after accepting username & password from user I want to create a text file on web server and then upload it to somewhere via ftp? Any one can help me doing this please? Best Regards, Usman Why dont you have a Web Service on the server that creates the text file and then make an instance of it when someone login that is creating the file.Mikael Söderström...

.Net 2.0 Web application using Vb.net is unable to create object of another dll writen in C# .net 2.0
Hi, I habe created one ASP.net web application using Vb.net which is adding reference of dlls written in C# and .net 2.0. But whenever trying to create object of referencing dll, it is throwing error :Object reference does not set to an object. But, locally it is working fine,. In the server i have deployed the .aspx files and dll files in the bin. There were already an web.config in the server which is of .net 1.1. But checked it is retrieving value for that web.config correctly. Should i have to deply any other files and if not what can be the solution for this? Please help. Thanks, So...

using non .net DLL in .net web application
Is it possible to use a non .NET DLL in a .NET web application ?I have a vb.net web application, and I am thinking of purchasing a pascal DLL to use in it.  I am not sure if its possible, or if there are any downsides?  I really don't want to run anything that could cause any problems or complications.Thanks! mike123 Yes, it's perfectly possible to use non-.NET DLLs. The way to do it is called Interop. If you Google for that, you'll find plenty on it.  just add reference ... compile ....and use...Please click Mark as Answer on this post if it helps y...

hei guys, i need help on my application, i'm using C#.NET as front-ed and SQL as back-end, aside from a datagrid, i want to display my data using textboxes and not a datagrid, i can do it using Visual Basic 6 but since i'm a newbee at C#.NET i don't know how to do it, specially the codes, can anyone help me with it? thank you in advance! If you are doing windows development, i would suggest using 'DataForm wizard' (Use Solution Explorer-->Rightclick project-->Add new Item-->New DataForm). It will guide you through steps. If you are doing web apps. Use quickstart to learn them. h...

File upload in chunks
So I downloaded the files from codeproject for the "upload files in chunks" application at http://www.codeproject.com/KB/XML/MTOMWebServices.aspx?df=100&forumid=250646&exp=0&select=2292508 I've adapted the c# code into vb.net and tests I run locally show it working ok.  Trouble is, the client side was written for windows application level client, not web, so I'm wondering if anyone has already got a bit of client side web coding to take an uploaded file and split it into chunks that is compatible with this web service at all? Well I use MTOM and WSE 3.0 ...

How to get new web app to use .NET 2.0 on Win2K server using .NET 1.1 as default framework?
I have .net framework1.1 and 2.0 on our server running win2K. i have existing applications that uses asp.net 1.1, i also have a new app that use ASP.net 2.0.  how can i set my new .NET 2.0 app to point to asp.net 2.0 without messing up my existing .NET 1.1 apps? To specify the ASP .Net version fro a web application, do the followingIn IIS Manager select the web application -> Properties -> ASP.Net TabSelect  ASP.Net version you want to use for the applicationRegards,PrashantDont forget to click "Mark as Answer" on the post that helped you. But I am running Win2K...

How to ftp a file
server: ftp.mysite.comusername: adminpassword: adminpath: /images/ I have the following code which saves the file to C: drive as test.tif. So, can i ftp the same file to the above site directly instead of saving it to harddrive. <code>I am actually doing the following: by using the same code logic can i ftp it or if there is another method can you please show me.Dim proc As ProcessStartInfo = New ProcessStartInfo proc.Arguments = "c:\test.tif -feederon -h -n -r 200 -multipagetiff -o"Process.Start(proc)</code> Thank you very much for the information....

Using .net AJAX enabled application in non .net Web Application
Hi,Does anyone have similar experience in development?  I want to check if it's possible to run .net ajax object (from one standalone .net framework platform in company) with non .net application (i.e. J2EE web application)?  It is because we want to add certain feature (i.e. office communicator chat) to our exist application (oracle J2ee). Please give me some advice :) Thanks! Hi, .Net AJAX is based on .Net Framework architecture. Thus .Net Framework currently lacks support for other platforms, such as Java. Please check this link: http://www.csharphelp.com/arch...

Reading Excel Files from a .Net Web Form
Hi, This might be a dumb question, but ... When reading an Excel file from a .Net Web Form, is it necessary to have Microsoft Excel actually installed on the client machine running the web form? Also, do the Excel files being read need to be saved as "values only" or can the values be extracted from a spreadsheet where the cells contain formulas? Thanks. -Wayne Hi, For the 1st part, Office is not necessary to be installed. But Download the Office XP PIAs and use them to develop Office XP solutions with Visual Studio .NET. For 2nd Part I think you need to use Values.Regar...

How to use the Streams in VB.NET for uploading the file
hi friends, I want to upload an Excel file(very large 100,000 records) to the webserver using Vb.NET My code (given down) works well when i upload the file to the local directory. If I upload to the webserver, as the file size is large i want to make use of streams and upload the file. Please help me .. How to use the Streams in VB.NET for uploading the file Thanks in advanceProtected Sub btnUploadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUploadButton.Click FileName.InnerHtml = FileField.PostedFile.FileName FileContent.I...

multiple file upload using my web form
Hi all. I work for a web company, and a website was built for a client, which lets the company that we built it for, upload images to their web server through the web page using a standard fileupload control. For each image they upload, some code in the background (vb .net) takes the details and adds the details to a database on the server, the loads the image to the server. On a regular basis they upload all their images this way, which can be hundreds of images! Is there a way for me to let them upload a folder full of images? This couldn't be an FTP job as code needs to work in the ...

FTP client in VB .NET , Upload File
How can i upload a file to the ftp ? so i read this http://www.codeproject.com/vb/net/FtpClient.asp although it's C# but it works , but while i set ftp.Method = System.Net.WebRequestMethods.Ftp.UploadFile it upload empty file in the ftp , i know , i am doing something stupid so how can i edit the code to upload the file successful ?   ...

How to upload files using System.Net.FtpWebRequest
Hi,How to upload files to linux server using System.Net.FtpWebRequest.Thanks in AdvanceSubhasis Chanda Hi May be this link will help you how to do that http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx  BabaIf this post was useful to you, please Don't forget to click "Mark as Answer". Thanks You.:-) Thanks a lot.  Subhasis Chanda Hi Subhasis, If the post was useful,please mark as answer so other can get the benfit of it.   Thanks, MAamirBabaIf this post was useful to you, please Don't forget to click "Mark as Answer&quo...

Web resources about - uploading files using FTP in asp.net - asp.net.web-forms

Uploading and downloading - Wikipedia, the free encyclopedia
Examples of a remote system from which a download might be performed include a web server , FTP server, email server, or other similar systems. ...

Facebook Lets You Tag Photos While They're Uploading
Facebook now lets you add tags to photos before they're finished uploading.

Facebook for iPhone 3.0 to Include Video Uploading for 3GS Owners
We’ve heard a lot of people say the iPhone’s built-in support for YouTube video uploading is going to make a huge impact on the number of people ...

Defence bureaucrat pleads guilty to uploading secret document online
... embarrassing security breach with &quot;Five Eyes&quot; intelligence document. A former junior Defence bureaucrat has pleaded guilty to uploading ...

Uploading Bautista bat flip GIFs could get you sued under TPP, copyright activists warn
Copyright activists say Canadians could face lawsuits, fines or worse for ripping the latest Justin Bieber CD or uploading an animated GIF of ...

Xiaomi apologizes for uploading address book data from smartphones without permission
Former Android head and Xiaomi VP Hugo Barra has apologized to owners of its smartphones for "any concern caused" by collecting contact data ...

Senator calls for FTC investigation of Apple and Google over stealth photo uploading capabilities
Is this how we’ll have to open apps in the future? When we broke the news that iOS (and later Android) apps could upload your photo library (along ...

YouTubers Now Uploading Over 35 Hours Of Video Per Minute!
This week YouTube's got some big news! YouTubers are now uploading over 35 hours of video per minute, up from 24 hours a minute in March.

Google Play Books updated with new design, PDF and EPUB uploading
Caught up in all of the hullabaloo around the keynote, Google Play Books received a notable update in the Play Store to not only bring new UI ...

Twitter rolling out group messaging, 30-second video uploading
Fast Company Twitter rolling out group messaging, 30-second video uploading Android Community Different social networks are doing everything ...

Resources last updated: 1/21/2016 9:29:13 PM