By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

FTP Upload - needs help badly

P: n/a
Hi,
Please help me with my vb dotnet code. I'm trying to upload a file to
an ftp website. The program seems hung on this line of code
"wrqToVendor.GetResponse". I'm not getting anything back.

I tried the webclient upload but it does not work for .NET framework
1.1. If you have any other suggestions, please let me know.

Appreciated your help in advance.

Teresa
Dim wrqToVendor As WebRequest
Dim wrsFromVendor As WebResponse
Dim thisStream As System.IO.Stream
Dim srReadLine As System.IO.StreamReader

wrqToVendor = WebRequest.Create("http://ftp.mywebsite.com" + "?" +
"c:\temp\test.txt")
wrqToVendor.Method = "PUT"
Dim myCred As New Net.NetworkCredential("myid", "mypassw")
wrqToVendor.Credentials = myCred
wrsFromVendor = wrqToVendor.GetResponse()
thisStream = wrsFromVendor.GetResponseStream
srReadLine = New System.IO.StreamReader(thisStream,
System.Text.Encoding.ASCII)

While (srReadLine.Peek() > -1)
value += srReadLine.ReadLine()
valueLineCount += 1
End While

wrsFromVendor.Close()
thisStream.Close()
srReadLine.Close()

Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

Here is a link to an ftp class for vb.net. It includes an
example of uploading a file.

http://support.microsoft.com/default...b;en-us;832679

Ken
------------------
<tp****@pepco.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi,
Please help me with my vb dotnet code. I'm trying to upload a file to
an ftp website. The program seems hung on this line of code
"wrqToVendor.GetResponse". I'm not getting anything back.

I tried the webclient upload but it does not work for .NET framework
1.1. If you have any other suggestions, please let me know.

Appreciated your help in advance.

Teresa
Dim wrqToVendor As WebRequest
Dim wrsFromVendor As WebResponse
Dim thisStream As System.IO.Stream
Dim srReadLine As System.IO.StreamReader

wrqToVendor = WebRequest.Create("http://ftp.mywebsite.com" + "?" +
"c:\temp\test.txt")
wrqToVendor.Method = "PUT"
Dim myCred As New Net.NetworkCredential("myid", "mypassw")
wrqToVendor.Credentials = myCred
wrsFromVendor = wrqToVendor.GetResponse()
thisStream = wrsFromVendor.GetResponseStream
srReadLine = New System.IO.StreamReader(thisStream,
System.Text.Encoding.ASCII)

While (srReadLine.Peek() > -1)
value += srReadLine.ReadLine()
valueLineCount += 1
End While

wrsFromVendor.Close()
thisStream.Close()
srReadLine.Close()
Nov 21 '05 #2

P: n/a
Thank you very much Ken. I'll check it out.

Teresa

Nov 21 '05 #3

P: n/a
If that doesn't work out for you (stability, consistent results,
generating events you need for status, doesn't work with your
particular FTP server, etc.) you can take a look at our
latest .NET FTP component:

http://www.xceedsoft.com/products/ftpnet

Take care,

On 11 Jun 2005 08:32:13 -0700, tp****@pepco.com wrote:
Thank you very much Ken. I'll check it out.

Teresa


--
Alex Leblanc
Xceed Software Inc.
http://www.xceedsoft.com

Check out our advanced .NET grid and SmartUI controls

Email: xL*******@xceedsoft.com (remove the first 'x')
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.