| Dart Home | PowerTCP Server for ActiveX | Custom Development | Reply | PowerTCP Server for ActiveX Topics | Forums |
| Author | Forum: PowerTCP Server for ActiveX Topic: change working directory fails |
| pwroblewski From: Austin, TX USA Posts: 38 Member Since: 11/21/03 |
posted December 13, 2004 6:22 PM I am evaluating the FTP server tool. I am currently displaying a virtual diretory structure to the client. I am having problems redirecting on the SecureFtpServer1_ChangeWorkingDirectory event. I have tried to set the CurrentPath then return a file listing but it has not worked successfully. Below is the code I have added to SecureFtpServer1_ChangeWorkingDirectory event. Private Sub SecureFtpServer1_ChangeWorkingDirectory(ByVal Request As DartSecureFtpServerCtl.IRequest, ByVal Response As DartSecureFtpServerCtl.IResponse) Dim strreturn Dim Data As New DartStream Err.Clear Request.Session.User.CurrentPath = Replace(Request.Parameters.Item(1), "/", "\") strreturn = Get_FileListing(True, Request) If Len(strreturn) > 0 Then Data.Clear Data.DeleteOnDestroy = True Data.Write strreturn Data.Position = 0 Response.Data = Data Response.DataSuccess = True Else Response.Cancel Response.Status = "500" Response.StatusText = MSG_Internal_Err End If Set Data = Nothing End Sub |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted December 13, 2004 6:34 PM You don't want to override the cwd event to do this. You want to override the List event and create a new directory listing. |
| pwroblewski From: Austin, TX USA Posts: 38 Member Since: 11/21/03 |
posted December 14, 2004 11:29 AM I commented out my code in the cwd event but it still failed. Upon login i redirect the list event, which displays a list of directories. The problem is when they go to change directory that I get the following error message. COMMAND:> CWD /1000001/Pin 550 /1000001/Pin: No such file or directory. ERROR:> Requested action not taken (e.g., file or directory not found, no access). The SecureFtpServer1_List event does the same thing as the cwd event... Private Sub SecureFtpServer1_List(ByVal Request As DartSecureFtpServerCtl.IRequest, ByVal Response As DartSecureFtpServerCtl.IResponse) Dim Data As New DartStream Dim strreturn As String On Error Resume Next Err.Clear strreturn = Get_FileListing(True, Request) If Len(strreturn) > 0 Then Data.Clear Data.DeleteOnDestroy = True Data.Write strreturn Data.Position = 0 Response.Data = Data Else Response.Cancel Response.Status = "500" Response.StatusText = MSG_Internal_Err End If Set Data = Nothing End Sub (Get_FileListing is a function that retrieves the directories and files from the database. If Request.Parameters.All = "" Then get directories else If Request.Parameters.All <> "" Then get files) |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted December 14, 2004 11:33 AM I meant to say that you need to supply the response to the LIST command in the List event and the response to the CWD in ChangeWorkingDirectory event. |
| pwroblewski From: Austin, TX USA Posts: 38 Member Since: 11/21/03 |
posted December 14, 2004 12:05 PM I'm not quite sure I understand what you are referring to. Can you please explain futher? I also tried setting the following in the list event and cwd event... response.status=250, response.datasuccess=true, Response.StatusText = "Success" all which have not made any difference |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted December 14, 2004 12:15 PM Ok, I just tried this and it works. Put this in your ChangeWorkingDirectory event: Request.Parameters(1) = "/" Response.Status = 250 Response.StatusText = "OK" that will cause the server to reply with a success message no matter what is used as an argument Now, put this in your List event: Dim Data As New DartStream Data.Write "dr-xr-xr-x 1 owner group 0 Nov 27 22:50 ." + vbCrLf Data.Write "dr-xr-xr-x 1 owner group 0 Nov 27 22:50 .." + vbCrLf Data.Write "-r-xr-xr-x 1 owner group 8723 Nov 27 13:08 About.frm" Data.Position = 0 Response.Data = Data This will the listing to always show one file (About.frm) |
| james.forrester@moodys.com From: New York, NY USA Posts: 2 Member Since: 03/08/05 |
posted March 8, 2005 12:52 PM How do I do this from C#? I'm doing the following: request.Parameters.Clear(); request.Parameters.Add("/",0); response.Status = 250; response.StatusText = "OK"; But it's still returning a 550. -James |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted March 8, 2005 12:57 PM This is the C# equivalent: Request.Parameters[1] = "/"; Response.Status = 250; Response.StatusText = "OK"; |
| Reply | PowerTCP Server for ActiveX Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|