Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

that depends on that http server

if this server offers directory listening then you can simple get the html code and parse it

if not then there is only a possibility in getting the html code of one of the pages and go to all links which belong to that server

 

generally said you have to parse a lot of things which isnt that difficult if you find some points which indicates a start and stop and so on

 

an example for directory listing would be:

http://www.apache.org/dist/

 

there you see folders and files

then you just have to go through each line and check the symbol before the name of the folder/file

a folder symbol indicates a folder and a all other symbols indicate a file

 

have fun :)

Posted

thanks for your reply.

 

what i tried to do was have vb.net look through the server files the same way it looks through files on my computer.

 

For example:

Dim files() As String = IO.Directory.GetFiles("http://199.98.xx.xx:xxxx/beams/")

 

However, when I try to run this, it says URIs not supported.

 

Is there some other class or function that would allow me to do this?

 

Thanks.

Posted

i don't have any code for you, but here is another way of accomplishing this. i've done something similar.

 

if the remote server supports asp.net, php, or any server-side scripting, you could probably write a script which reads the directory and prints each file on a new line.

 

for example we will call this script: dir.aspx ... when called, it would look something like this:

 

file1.zip

file2.zip

someotherfile.zip

 

so then you can make your vb.net application read: http://123.45/folder/dir.aspx and build an array of files based on that text.

 

sorry i don't have code for you, just the logic.

 

i wrote a .net windos app which does this, but i'm using php on the remote server to print out the files in the directory.

 

hope this helps. good luck.

Posted

thanks for the idea, sde.

 

using php on the server side, would i also be able to edit and delete files on the server using my application because I will also need to do that.

 

Thanks.

Posted

i suppose you could send a variable to the script, like:

 

http://host/folder/dir.php?action=delete&file=a.txt

 

then you would use php to delete the file ( unlink(filename); ) the directory would have to be '777' to allow php to delete files though.

 

this code would be something like:

<?
if($action == "delete")
{
 unlink($file);
}
?>

i'm not sure what type of files, but once you have the file names, you could download or read the files, then you could edit them in your .net app, and overwrite them back up to the server.

 

you would need to make an upload method. the directory will already be '777' permissions, so that should cover you there.

Posted

oh i thought you want to get the files of a host which you dont own

i could write something like a directory listing in php for you if that is a problem..

 

so the parse way is only for hosts you dont have access

Posted

thanks...i will have to look for tutorials on php now i guess..if you have any quick helpful links or sample code, i would appreciate it.

 

thanks again!

Posted

PHP code

 

 

<?php

if ($handle = opendir('.')) {

while (false !== ($file = readdir($handle))) {

if ($file != "." && $file != "..") {

echo "$file<br>";

}

}

closedir($handle);

}

?>

 

 

that is just a simple way to display all files :)

Posted

i am now wondering how i can display the files and directories on the server in the folder browser dialog box...anyone know if there is a way to do this?

 

thanks!

Posted

the folder browser dialog box is a component of visual studio 2003 that allows the user to select a directory in a dialog box..similar to the file dialog box..except it only shows directories. so what i want to do is display the directories on the ftp server in that dialog...

 

any ideas are appreciated.

Posted
Don't use the class. It is buggy and will crash your application if selected path length > 135 characters (very unpredicatable when it will crashed).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...