The App_Data folder of MVC application is used to contain the application related data files like . mdf files, LocalDB, and XML files, etc. The most important point that you need to remember is that IIS is never going to serve files from this App_Data folder.
The App_Code folder can contain sub-directories of files, which can include class files that in different programming languages. Contains application data files including . mdf database files, XML files, and other data store files.
You can store source code in the App_Code folder, and it will be automatically compiled at run time. The resulting assembly is accessible to any other code in the Web application. The App_Code folder therefore works much like the Bin folder, except that you can store source code in it instead of compiled code.
ASP.NET defines several special folders. When a new Web site is created the App_Data folder is created by default; it can contain a SQL Server 2005 Express Edition database, another database, or an XML data file that will be used in the Web site.
App_Data is essentially a storage point for file-based data stores (as opposed to a SQL server database store for example). Some simple sites make use of it for content stored as XML for example, typically where hosting charges for a DB are expensive.
in IIS, highlight the machine, double-click "Request Filtering", open the "Hidden Segments" tab. "App_Data" is listed there as a restricted folder. Yes i know this thread is really old, but this is still applicable.
The intended use of App_data is to store application data for the web process to acess. It should not be viewable by the web and is a place for the web app to store and read data from.
It's a place to put an embedded database, such as Sql Server Express, Access, or SQLite.
The App_Data folder is a folder, which your asp.net worker process has files sytem rights too, but isn't published through the web server.
For example we use it to update a local CSV of a contact us form. If the preferred method of emails fails or any querying of the data source is required, the App_Data files are there.
It's not ideal, but it it's a good fall-back.
From the documentation about ASP.NET Web Project Folder Structure in MSDN:
You can keep your Web project's files in any folder structure that is convenient for your application. To make it easier to work with your application, ASP.NET reserves certain file and folder names that you can use for specific types of content.
App_Data contains application data files including .mdf database files, XML files, and other data store files. The App_Data folder is used by ASP.NET to store an application's local database, such as the database for maintaining membership and role information. For more information, see Introduction to Membership and Understanding Role Management.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With