ftp from ASP.Net 2.0

G

Guest

I believe that I have spent days looking for a "HOW TO" on developing an ftp
process from an ASP.net 2.0 page that utilizes a "FileUpLoad" control.

Can I not just call the "SaveAS"(ftp_site, username, password + filename)
method? If I can't do this someone please point me in the direction of how
this task can get done.

Is there more to it? I don't know... that is why I am posting a call for help.
 
G

Guest

Thank you Juan for the link.
I received this error at the requeststream = uploadrequest.getstream
"ex.Message = "The requested URI is invalid for this FTP command."

This is how I populated the upload sub
If Me.File1.Value <> "" Then
Try
Upload(Me.File1.Value, "ftp://new file server.com/")
Catch ex As Exception
Me.txtSubmittedFile.Text = "Error: " & ex.Message.ToString
End Try
End If
If I need to pass the username and password would that cause the error?
 
J

Juan T. Llibre

re:
I received this error at the requeststream = uploadrequest.getstream
"ex.Message = "The requested URI is invalid for this FTP command."
If I need to pass the username and password would that cause the error?

If you need to pass a username and password, you can pass them with :

WebClient request = new WebClient();
request.Credentials = new NetworkCredential ("username", "password");
 
G

Guest

Thank you!! Thank you!! I really appreciate the link and the last bit about
the password.

Again, Thank you!!!
 
J

Juan T. Llibre

re:
Thank you!! Thank you!! I really appreciate the link and the last bit about
the password.

Again, Thank you!!!

You're welcome! You're welcome! I really appreciate your enthusiasm!
Again, you're welcome!

:)

I'm glad that tip got you up and running...
You just made my weekend a lot more pleasurable.

;-)
 
G

Guest

To extend this process, is it possible to loop through the reader(in the list
portion of the FTPSample kit) to create something like a treeview, that would
list the folders and files on an FTP server, should they want to download a
file from the server to their local machines?

Please point me to the next level.
 
G

Guest

Juan, Using the Microsoft link example, I run into an issue on the "Upload"
where the "SendCommand("PASV")". The "ReadLine" function errors out on the
following
line
m_iBytes = m_objClientSocket.Receive(m_aBuffer, m_aBuffer.Length, 0)
and returns a error of "An unknown, invalid, or unsupported option or level
was specified in getsocketopt or setsocketopt call"

Any idea what this is about? I am running this on an ASP.net 2.0 form that
just has a button to start this program.
 
Joined
May 11, 2007
Messages
1
Reaction score
0
solved

hi i solved that problem.. had the same...

so:

instead of:
'Convert the byte array back into a string.
roundtrip = [unicode].GetString(fromEncrypt)

'Display the original data and the decrypted data.
Return roundtrip

do like this;
'Convert the byte array back into a string.

Dim testStr() As Char = [unicode].GetChars(fromEncrypt)
For i As Integer = 0 To testStr.Length
If Not testStr(i) = Nothing Then
roundtrip = roundtrip + testStr(i)
Else
Exit For
End If
Next i

'Display the original data and the decrypted data.
Return roundtrip


problem was that Byte vas 14 long but actualy u need only like 12 and getString returnen: "pass
(...yah with no quote at the end whitch hang up the pasv send function)


btw: took me all day to figure out the mistake...

=?Utf-8?B?c3BhcnR5MTAyMg==?= said:
Juan, Using the Microsoft link example, I run into an issue on the "Upload"
where the "SendCommand("PASV")". The "ReadLine" function errors out on the
following
line
m_iBytes = m_objClientSocket.Receive(m_aBuffer, m_aBuffer.Length, 0)
and returns a error of "An unknown, invalid, or unsupported option or level
was specified in getsocketopt or setsocketopt call"

Any idea what this is about? I am running this on an ASP.net 2.0 form that
just has a button to start this program.

"Juan T. Llibre" wrote:

> You'll find all the info you need to build your client at :
>
> http://dotnet.mvps.org/dotnet/faqs/?id=ftp&lang=en
>
> There's a fairly good sample at :
> http://support.microsoft.com/?scid=kb;EN-US;832679
>
> There's a basic client sample at :
> http://www.freevbcode.com/ShowCode.Asp?ID=4655
>
> Another free sample is at :
> http://www.codeproject.com/dotnet/dotnetftp.asp
>
> Enjoy!
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en español : http://asp.net.do/foros/
> ===================================
> "sparty1022" <[email protected]> wrote in message
> news:[email protected]...
> > To extend this process, is it possible to loop through the reader(in the list
> > portion of the FTPSample kit) to create something like a treeview, that would
> > list the folders and files on an FTP server, should they want to download a
> > file from the server to their local machines?
> >
> > Please point me to the next level.
> >
> >
> > "Juan T. Llibre" wrote:
> >
> >> re:
> >> > Thank you!! Thank you!! I really appreciate the link and the last bit about
> >> > the password.
> >> >
> >> > Again, Thank you!!!
> >>
> >> You're welcome! You're welcome! I really appreciate your enthusiasm!
> >> Again, you're welcome!
> >>
> >> :)
> >>
> >> I'm glad that tip got you up and running...
> >> You just made my weekend a lot more pleasurable.
> >>
> >> ;-)
> >>
> >>
> >>
> >>
> >> Juan T. Llibre, asp.net MVP
> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> asp.net faq : http://asp.net.do/faq/
> >> foros de asp.net, en español : http://asp.net.do/foros/
> >> ===================================
> >> "sparty1022" <[email protected]> wrote in message
> >> news:[email protected]...
> >> > Thank you!! Thank you!! I really appreciate the link and the last bit about
> >> > the password.
> >> >
> >> > Again, Thank you!!!
> >>
> >> > "Juan T. Llibre" wrote:
> >> >> re:
> >> >> > I received this error at the requeststream = uploadrequest.getstream
> >> >> > "ex.Message = "The requested URI is invalid for this FTP command."
> >> >> > If I need to pass the username and password would that cause the error?
> >> >>
> >> >> If you need to pass a username and password, you can pass them with :
> >> >>
> >> >> WebClient request = new WebClient();
> >> >> request.Credentials = new NetworkCredential ("username", "password");
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> Juan T. Llibre, asp.net MVP
> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> >> asp.net faq : http://asp.net.do/faq/
> >> >> foros de asp.net, en español : http://asp.net.do/foros/
> >> >> ===================================
> >> >> "sparty1022" <[email protected]> wrote in message
> >> >> news:[email protected]...
> >> >> > Thank you Juan for the link.
> >> >> > I received this error at the requeststream = uploadrequest.getstream
> >> >> > "ex.Message = "The requested URI is invalid for this FTP command."
> >> >> >
> >> >> > This is how I populated the upload sub
> >> >> > If Me.File1.Value <> "" Then
> >> >> > Try
> >> >> > Upload(Me.File1.Value, "ftp://new file server.com/")
> >> >> > Catch ex As Exception
> >> >> > Me.txtSubmittedFile.Text = "Error: " & ex.Message.ToString
> >> >> > End Try
> >> >> > End If
> >> >> > If I need to pass the username and password would that cause the error?
> >> >> >
> >> >> >
> >> >> > "Juan T. Llibre" wrote:
> >> >> >
> >> >> >> Please review :
> >> >> >>
> >> >> >> http://msdn2.microsoft.com/en-us/library/b7810t5c(VS.80).aspx
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> Juan T. Llibre, asp.net MVP
> >> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> >> >> asp.net faq : http://asp.net.do/faq/
> >> >> >> foros de asp.net, en español : http://asp.net.do/foros/
> >> >> >> ===================================
> >> >> >> "sparty1022" <[email protected]> wrote in message
> >> >> >> news:[email protected]...
> >> >> >> >I believe that I have spent days looking for a "HOW TO" on developing an ftp
> >> >> >> > process from an ASP.net 2.0 page that utilizes a "FileUpLoad" control.
> >> >> >> >
> >> >> >> > Can I not just call the "SaveAS"(ftp_site, username, password + filename)
> >> >> >> > method? If I can't do this someone please point me in the direction of how
> >> >> >> > this task can get done.
> >> >> >> >
> >> >> >> > Is there more to it? I don't know... that is why I am posting a call for help.
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>

>
>
>
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top