473,382 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to delete a file at a remote web location.

Hi

I've a C# windows application that scans for XML files at a remote URL
address and downloads them to the local machine when they arrive. I
can do that OK with HttpWebRequest or WebClient.

After they've been downloaded I want to delete them from the remote
location (or if not possible, move or rename them). I can't see how to
do it.

Advice or ideas would be much appreciated.

John South
Pangbourne UK
www.wherecanwego.com

May 26 '06 #1
3 1533
I would probably write a simple web-page (ashx or asmx depending on what is
calling it) that accepts a reference to the file (in the post for ashx or in
the arguments for asmx) (along with whatever security / authentication info
you need), and then the web-server can delete it's own file (locally) by
resolving the reference to a physical file (MapPath perhaps). I would also
rig the new page to *ONLY* delete files e.g. under a certain path (and
exclude anything containing ".." or starting with "/" or "~/") to prevent
incorrect (or just evil) usage from wiping the web-server.

Marc
May 26 '06 #2
Many thanks Marc. That should do it.

John South
Pangbourne UK
www.wherecanwego.com
Reply

May 30 '06 #3
Hi Marc

I've got this working using a .ashx file to do the File.Delete but now
I'm installing it on a test system I'm struggling with the security
set-up. Can you give any clues on how to specify the user account that
the ashx file will use and how to give that account the rights to
delete a file.

I thought I understood this but obviously not.

Thanks

John South

Jun 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: ebobnar | last post by:
I've written a link aliasing script that allows users to rewrite urls on their web pages. The crux of the script is the following: if(getimagesize($redirect_to) == 0) header("Location:...
0
by: Peter A. Schott | last post by:
Got a strange scenario going on here in that I could have sworn this worked yesterday. I am issuing binary retrieval calls to an FTP server, writing to a file, close the file, then removing the...
0
by: Peter A. Schott | last post by:
If I want to verify that a file has finished writing before deleting the remote file, what would be the best method? Current code on Python 2.4: #filename - remote FTP server File Name...
0
by: SeanR | last post by:
I have a function to copare two files. It will first copy the original file form a different server to a local temp path and then compare that version to a version that has been restored form tape....
7
by: Ben R. | last post by:
Hi, I'm working on an ASP.NET 2.0 site and my hosting provider has the root in a different place than I have it locally which is not a problem for most things, except for the access oledb...
3
by: Arpan | last post by:
A Form has a FileUpload, 2 Buttons & a TextBox web server controls. Using the FileUpload control, I want to give users the provision to move & delete files that DO NOT exist in C:\Inetpub\wwwroot...
1
by: Bob Jones | last post by:
I am using ASP.NET 2.0 w/ c#. I have an Http handler that intercepts any request labeled .file. I am trying to have this handler serve up a file from a remote location (public) and I do not want to...
4
Manikgisl
by: Manikgisl | last post by:
we are able a download File from the Web share using Web client Can we do same for Deleting a file or Some other code sample to do this Thanks in Advance
2
Airslash
by: Airslash | last post by:
Hi, I'm currently working on a function to delete a folder and its files + subfolders. The function currently works for the target folder, but refuses to delete the subfolders and files in the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.