Search code examples
asp.net-mvcasp.net-mvc-4directory-structure

ASP.Net MVC 4 Project Folder Architeture


My ASP.Net MVC 4 Web project have this architeture:

App_Data
App_Start
Content
 - css
 - images
 - scripts
Controllers
Helpers
Models
Views

I need to create a folder to save temporary files for download and I don't know where I can create that folder. My main doubt is if I create at the first level or inside the App_Data folder.

I'm just trying to be careful to not compromise the project architeture.


Solution

  • I wouldn't even make it apart of your project. I would use something like Path.GetTempFileName() or Path.GetTempPath() and allow the framework to tell me where I can place those temporary files. Keeps your application directories clean and keeps temporary files in a location that could be safely cleaned up periodically (or your application could delete the file when it's done).