How can I read the files of a directory on a web server?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

ok, here is my situation:
I want to create an app that dynamically loads new components from a web
server. to do that I have to read all files in a directory on the webserver.
How can I do that?
 
System.IO.Directory
System.IO.DirectoryInfo
System.IO.File
System.IO.FileInfo

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition
 
I already know these classes and I tried this:

If System.IO.Directory.Exists("http://localhost/ACalcComponents/") Then
Me.txtError.Text = "Yeah!"
Else
Me.txtError.Text = "D'oh!"
End If

the answer is "D'oh", although the directory exists. I don't really know how
the path string should look like? I also tried it with
"file:///localhost/ACalcComponents/" , but I also doesn't work. Can you
please give me a small example of your solution?
 
i should mention that I want a client (that runs on a different computer) to
get the files from the directory on the web server.
 
HTTP is a TCP transport protocol. It is not a file system protocol. You
cannot use an HTTP url with IO classes. You can either use a file path or
UNC, or use a web client to get the file via HTTP.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition
 
ok, i can load the html file that contains the file list. But are there any
special classes to read data from an html file in .NET?
 
An HTML file is pure text. What exactly do you mean by "read" it?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition
 
I mean something like the system.xml classes for xml documents, but for html,
so that I can easily get a list of all <A HREF...> tags in the document for
example. I just want to avoid to write an own parser if something like this
exists. but I haven't found anything yet...
 
Back
Top