The ASP.NET 2.0 Special Folders

Key points about the ASP.NET 2.0 Special Folders & specifically App_Code folder, compiled from MSDN docs for easy reference:

  1. ASP.NET recognizes certain folder names that you can use for specific types of content & the names of these special folders are reserved. The reserved folder names and the type of files that the folders typically contain are listed below:
    • App_code : Shared application code (.cs, .vb, and .jsl files & also .wsdl and .xsd files)
    • App_globalresources : Common resource files (.resx and .resources files)
    • App_localresources : Localized resource files (.resx and .resources files)
    • App_webreferences : Links to web services (.wsdl, .xsd, .disco and .discomap files)
    • App_data : Local databases for membership, web parts, etc. (.mdf and .xml files)
    • App_browsers : Browser specific settings (.browser files)
    • App_themes : Theme settings (.skin and .css files, as well as image files and generic resources)
    • Bin : Referenced assemblies (.dll files)
  2. Except App_Themes, these directories are protected against web access at the ISAPI layer linking ASP.NET to IIS.
  3. The App_Code folder works much like the Bin folder, except that you can store source code in it instead of compiled code.
  4. The App_Code folder can contain source code files (*.vb, *.cs etc) & also files that are not explicitly in a specific programming language like .wsdl (Web service description language) files and XML schema (.xsd) files for ASP.NET to compile them into assemblies.
  5. The App_Code folder can contain as many files and subfolders as you need. ASP.NET will still compile all of the code into a single assembly that is accessible to other code anywhere in the Web application.
  6. Because the source code in the App_Code folder is compiled into a single assembly, all the files in the App_Code folder must be in the same programming language. You can however configure your Web application to treat subfolders of the App_Code folder as separate compilable units.
  7. User controls are not allowed in the App_Code folder.
  8. ASP.NET infers which compiler to invoke for the App_Code folder based on the files it contains.

Comments