Click here to Skip to main content
15,895,922 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Can any one suggest me how can i delete a file from folder, if am using a chrome or mozilla browser.


I can delete file from folder Using File.Delete(Path) if am using IE but not from chrome.

Note : I have written a code to delete a file in a Handler.
Posted
Comments
Sergey Alexandrovich Kryukov 3-Mar-12 14:33pm    
How can it depend on Web browser?
--SA
Joachim1234 4-Mar-12 14:49pm    
Are you sure it isn't javascript you are using, like this:

var myObject;
myObject = new ActiveXObject("Scripting.FileSystemObject");
var f = myObject.GetFile("c:\\test.txt");
f.Delete();

Because this is only supported by IE.

Regards
Joachim

1 solution

You certainly misunderstand how Web works. The code you show is done on the server side and attempts to delete a file on the server's how. It has nothing to do with a Web browser. Perhaps even your observation is inaccurate or your problem description is incorrect. If you can delete a file successfully, the browser does not matter.

—SA
 
Share this answer
 
Comments
binkujsr 4-Mar-12 2:04am    
Hi SAK,

It may be i misunderstood, but my observation is correct.Please do try it from your side write this code to delete file from server. and run your page from chrom or mozilla although it works fine if you run your code in IE
Sergey Alexandrovich Kryukov 4-Mar-12 3:50am    
Nothing to try. Maybe you delete it with one browser and try to delete with another one. Naturally it won't work if you did not restore the file. There is also such thing as cache. Who knows? Anyway, you don't even show your code. It could be something which did not even came to your or my mind... Think again: there is no a Web browser on the server side. After all, log some debug information, catch all exceptions and log exception information... There is no such thing as miracle. At the time the file is deleted, a browser does not even exist...
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900