Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting a file using thw webclient

Status
Not open for further replies.

aspro

Programmer
Jan 22, 2003
69
0
0
AU
I know you can delete files and folders using the directory class but is there a way to delete a file that is located on a web server, using the Webclient?

Many thanks,
aspro
 

WebClient Class - Provides common methods for sending data to and receiving data from a resource identified by a URI

The WebClient class provides four methods for uploading data to a resource:
-OpenWrite returns a Stream used to send data to the resource.
-UploadData sends a byte array to the resource and returns a byte array containing any response.
-UploadFile sends a local file to the resource and returns a byte array containing any response.
-UploadValues sends a NameValueCollection to the resource and returns a byte array containing any response.

The WebClient class also provides three methods for downloading data from a resource:
-DownloadData downloads data from a resource and returns a byte array.
-DownloadFile downloads data from a resource to a local file.
-OpenRead returns the data from the resource as a Stream.

The webclient uses the http protocol which does not handle file/directory manipulation (other then sending or receiving data).

You'll want to use either the FTP protocol, which is designed for just such things (but requires sockets-programming which can be difficult to learn), or a server-script (such as an Asp.net, Asp, PHP, CGI, ...).

-Stephen Paszt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top