I need to store uploaded files temporarily while a user decides how they want to process the file they have just uploaded. I thought I would store these files in the App_Data folder in a subfolder called Temp.
The issue is that my application complains that there is no folder “~/App_Data/Temp” unless I manually create it and set the permissions on the folder for the network user to allow writes. This is annoying to have to do every time I publish a new build.
Any ideas on how I can get around this problem? Is there a better place to store these temporary files?
You could create a virtual directory in IIS that points to a static location on the operating system. The directory that the virtual directory points to should remain constant after every publish (this might not be true depending how you publish your application). With this in place, you only need to setup permissions once, and you can map the path of the virtual directoy to it’s file system directory using Request.MapPath in code.