Suppose I want to run exe from the Internet, but most likely I will most likely upload it to a temporary folder. Run it from there and delete it (or let the OS do it). Is there any agreement on how to do this, being sure not to bomb permission problems, overriding an existing file, etc.?
Thanks.
EDIT . I am using a desktop application. By the way, I have a lot of guesses, but I'm just wondering what is accepted.
I know what I can use Path.GetTempFile, but then he already made a file for me, which makes me think that he can also add it to some db and keep track of it - so I can’t delete it and replace it with my own file.
I know that I can also use Path.TempDirectory(or something similar) and Path.RandomFileName, but the latter adds a random extension to the file name, while I need exe, obviously this can be easily resolved too, but it seems strange to rewrite what that it seems that MS has already tried to write for us.
source
share