Hi,
I have a asp.net/c# web app. When do user leave a certain page, I would like to delete 1 particular temp file on the client machine, in the temp file folder. Can I do this at all? Can I do this server side or client side?
Thanks.
Hi,
I have a asp.net/c# web app. When do user leave a certain page, I would like to delete 1 particular temp file on the client machine, in the temp file folder. Can I do this at all? Can I do this server side or client side?
Thanks.
For security reasons, this is completely impossible.
(Unless you're asking to delete your own cookie)
If you don't want the browser to cache your files, you can use the HTTP caching headers.
You can't delete a file from the end users machine - without using something like an ActiveX. That would tie your users to Internet Explorer though.
A better solution might be to set the applicable caching directives so that the browser doesn't store the file in its cache, that way it won't actually be written to disk (I'm assuming here that the file is one that is being pulled down by the browser as part of viewing/loading the page).
For example:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0)));
Response.Cache.SetNoStore();
If you really wanted to do this, and it wasn't as simple as preventing a file from being cached then as I said, using an ActiveX would be pretty much the only option. If you were going to develop an ActiveX control to do this, I'd strongly recommend you review MSDNs documentation on Per-Site ActiveX Controls. Deploying an ActiveX control, even within an intranet, that allowed files to be deleted from the end users PC from any domain could only be considered reckless at best, negligent at worst.