Wrox Programmer Forums
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 31st, 2006, 04:46 PM
Registered User
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rrlevron
Default FTP problems

I am having trouble ftp'ing .dat files to a mainframe using FtpWebRequest class in ASP.NET 2.0. I can ftp to my friends server fine, but not to one of our mainframes.

Here is my code:


            Dim uri As New Uri("ftp://ibmmain/RME.LGNGEAC.EXTRACT.dat")

            If uri.Scheme = uri.UriSchemeFtp Then

                '1) Create FTP request object
                Dim request As FtpWebRequest = FtpWebRequest.Create(uri)

                '2) Call the upload method
                request.Method = WebRequestMethods.Ftp.UploadFile

                '3) Set network credentials
                request.Credentials = New NetworkCredential("rme", "geac1")

                '4) Create a filestream object
                Dim fs As New FileStream(Server.MapPath("hr.lgngeac.extract.txt" ), FileMode.Open, FileAccess.Read, FileShare.Read)
                Dim data(fs.Length) As Byte

                '5) Read the file into a byte array
                fs.Read(data, 0, fs.Length)

                '6) Call the GetRequestStream()write() method to upload
                request.GetRequestStream.Write(data, 0, fs.Length)

                '7) Close the stream after use

                '8) Assume the FTP transfer was successful, set the result flag to true
                result = True
                Return result
            End If
        Catch ex As Exception
            lblMessage.Text = ex.Message
        End Try

Here is the error:

System.Net.WebException was caught
  Message="The remote server returned an error: (501) Syntax error in parameters or arguments."
       at System.Net.FtpWebRequest.CheckError()
       at System.Net.FtpWebRequest.SyncRequestCallback(Objec t obj)
       at System.Net.FtpWebRequest.RequestCallback(Object obj)
       at System.Net.CommandStream.InvokeRequestCallback(Obj ect obj)
       at System.Net.CommandStream.Abort(Exception e)
       at System.Net.FtpWebRequest.FinishRequestStage(Reques tStage stage)
       at System.Net.FtpWebRequest.GetRequestStream()
       at Extract.SendFTPFile() in C:\Applications2005\GEAC1\GEAC_UI\Extract.aspx.vb: line 141

Anybody have a solution?


Old December 20th, 2007, 02:55 PM
Registered User
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Have you found a solution to your issue. I am currently having the same problem and can not find an answer to it. Any help is appreciated... Thanks

Similar Threads
Thread Thread Starter Forum Replies Last Post
ftp zaghmout C# 2005 2 November 6th, 2007 09:55 AM
Problems with FTP hugh@kmcnetwork.com Pro Visual Basic 2005 0 November 21st, 2006 12:46 PM
FTP pakman Excel VBA 2 June 30th, 2005 05:58 AM
FTP pakman BOOK: Excel 2003 VBA Programmer's Reference 0 June 27th, 2005 04:24 AM
FTP? Nasimov Visual C++ 1 December 24th, 2003 09:24 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.