I’m working on a legacy .NET project. As per the new requirement I’m trying to save the uploaded jpg files for some processing. So I’m getting the executing assembly and create a temporary folder to store images. My question is the ExecutingAssembly returns something like “C:WindowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET FilesApplicationName” but still I can store and and process jpg files in that folder. So is it ok to store files in “Temporary ASP.NET” folder. Will it cause any problem?
Note: The stored images will be deleted after doing some process and don’t need to be retained
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
This folder is used to cache the compiled assembly. When the user requests resources from the website, the web page will be dynamically compiled, and then cached in this folder. When there are subsequent user requests, the resources can be directly obtained from the cache instead Compile again.
More information can be found in Understanding ASP.NET Dynamic Compilation
So it can be said with certainty that if the image you want to process does not need to be stored permanently or destroyed after processing, it can be stored in this folder. Similarly, the contents of the folder can also be deleted, which will not affect your application, but it needs to be recompiled when users request resources, which may take a little longer.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0