Computer.FileSystem.DeleteFile not working over network

J

Julia B

Hi all

I've got an ASP.Net 2.0 web application, where users are uploading files to
the web server from a C drive on a networked pc.

The upload and save work fine, but once done, I want the original file on
the pc D drive to be deleted.

The code I'm using is:

My.Computer.FileSystem.DeleteFile(Me.newCalibrationRecord.RecordLocation)

Me.newCalibrationRecord.RecordLocation is "C:\DirectoryName\Filename".

I get an error message saying the file cannot be found despite the fact that
I know it's there. I've also checked permissions and the ASP.NET account has
the correct permissions to the pc's C drive.

Is it something to do with the fact that the application is looking on the
webserver's C drive not the user's local machine?

Thanks in advance
Julia
 
P

Patrice

Hi,

Sure keep in mind that the web page runs ont he server so c: is the server
drive.

More generally what you want to do is not possible (you don't have access
out of the box to a user machine for safety reasons). If you are under a
controlled environment you could perhaps achiveve this (establishing shares
on your wokrstation or installing a client side tool to do that suc as a
ajava, activex or dotnet applet). The big picture could help to raise better
suggestion. What are trying to do ? Whay to delete the file once uploaded ?
(some kind of file repository system ??)
 
J

Julia B

Hi Patrice

Thanks for the help. My users have requested that the file on the c drive be
deleted once uploaded to the web application. It's a file sorting/respositary
application and if the original file is deleted then it reduces their
workload.

Although we are on a large network, there is only one pc that will be using
this application so it only applies to the one pc. Would that help?

Julia
 
J

Julia B

Because it's a company application and multiple users/machines will access it
to view information but there is only one machine that needs to upload
information to the system.

Julia
 
J

Julia B

Mark Rae said:
[please don't top-post]
Because it's a company application and multiple users/machines will access
it
to view information but there is only one machine that needs to upload
information to the system.

Sounds like you need a WebForms app and WinForms app
Mark

Sorry about top posting, didn't know it was an issue.

Users have requested one application as, although only one pc will upload
documents, the users on that pc will also use all the other functions and
don't want to move between applications, so a web application has been
selected to be the best method for the whole thing.

With this in mind is there any way around this?

Thanks
Julia
 
J

Julia B

Mark Rae said:
Top-posting means people have to read backwards any thread that you reply
to:
http://www.caliburn.nl/topposting.html



All modern browsers are specifically written to prevent this sort of direct
interaction with the hardware and software of the machine on which they're
running, for obvious reasons. E.g. if a web app can delete
C:\MyUploadFile.txt, what's to stop it also deleting C:\bootmgr? A bit of an
extreme example, but I trust you get the point...



Not natively... You'd need to look at some sort of ActiveX control for this,
but that would mean that you'd have to ramp the browser security right down
just to get it to load, never mind run...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Mark, thanks for your help, I will discuss this with my users.
Julia
 
E

Ed Murphy

Julia said:
Users have requested one application as, although only one pc will upload
documents, the users on that pc will also use all the other functions and
don't want to move between applications, so a web application has been
selected to be the best method for the whole thing.

With this in mind is there any way around this?

Have the server delete the file via UNC, e.g.
\\THE_PC\C$\DirectoryName\Filename
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top