ASP.NET, App_Code, App_Data and so the role of the folder
1. Bin folder
Bin folder contains the necessary application for the controls, components, or need to reference any other code can be deployed assembly. The existence of any directory. Dll file will automatically link to the application.
2. App_Browser folder
The optional folder contains. Browser file. . Browser file describing the browser (either mobile device browser, or a desktop browser) features and functions.
3. App_Code folder
App_Code folder, just in the Web application root directory, which stores all part of the application should be as dynamic compiled class files. These class files automatically link to the application, without requiring the page to add any explicit directive or statement to create dependency. App_Code folder to place the class file can contain any identifiable ASP.NET components - custom controls, auxiliary class, build provider, business class, custom provider, HTTP handling procedures.
Note that during development, changes to the App_Code folder will cause the entire application to recompile. For large projects, this may not be popular, and very time-consuming. To this end, encourage modular code for processing to a different class library, according to logically organize a collection of related classes. Application-specific helper classes should be placed mostly in the App_Code folder.
App_Code folder, all the class files should be stored using the same language. If the class files written using two or more languages, you must create a language-specific subdirectory, to include the class with each language. Once these types of documents depending on the language organization, we must in the web.config file, add a subdirectory for each set:
<add directoryName="VBFolder" />
Importantly, the specific language subdirectories should be registered in the web.config file, otherwise, no matter which folder they belong to, App_Code folder of all files will be compiled into a single assembly. The configuration script describes such a situation in which all the C # files are placed in App_Code folder in the root directory, while the number of Visual Basic
. NET class file into VBFolder directory. If <codeSubDirectories> section mentioned directory does not exist, will receive a compile error.
App_Code root folder of the files are compiled into App_Code_xxx.dll assembly, where xxx is a randomly generated sequence of characters. A given subdirectory in the file will be compiled into a dynamic created called App_SubCode_xxx_yyy.dll assembly instructions which subdirectory the name of xxx, and yyy is a random sequence of characters. Only in the application root directory in the web.config file was set, <codeSubDirectories> section to be effective.
In the App_Code directory or any other place a subdirectory assemblyinfo.cs file, you can create a strong named assembly. Obviously, if the folder contains the Visual Basic. NET file, then uses
assemblyinfo.vb file. Assembly can refer to a configuration file. Snk file to save the strong name key.
Attention to an assembly to set a strong name, you must first obtain a public / private key pair. By using a strong name (Strong Name) tools (sn.exe), get a key pair. Strong name tool is we can. NET Framework installation path to one found in SDK binary. Key pair files usually have a. Snk extension. Can save the file to an application folder, and file references in the assemblyinfo.cs it
[Assembly: AssemblyKeyFileAttribute (@ "yourKeyPair.snk")]
Note, Visual Basic. NET is a Visual Studio Solution that contains the directory to find key documents
The C # compiler in the directory that contains the binary search for key documents. Accordingly know that, with this attribute to adjust our use of the path, or the key file in the appropriate folder.
In any subsequent re-generation, the assembly name will change. Meanwhile, the old AppDomain request an end to remove the old assembly.
App_Code folder not only contains the class files. In particular, it can contain and can automatically handle the data structure on behalf of
XSD file. To an XSD file to the folder, the compiler will it resolve into a type
DataSet class, and add it to the application scope. In ASP.NET 1.x, this work by the Visual
Studio. NET wizard, use a command line utility (xsd.exe) completed.
Note that using the web.config file to register a component (for example, a custom server control or a custom HTTP handler), it is usually asked to specify the assembly that contains the code name. If the component definition
In the App_Code folder, you should use what name to indicate the assembly? In this case, just ignore the assembly information, and provides for the full class name can be. If you do not require any assembly, the ASP.NET runtime will try to load the program from any kind of concentrated load, including the App_Code folder dynamically created assembly.
4. App_Data folder
App_Data folder should contain the application's local data storage. It is usually a document (such as Microsoft
Access or Microsoft SQL Server Express databases, XML files, text files and application support of any other document) that contains the form of data storage. The contents of a folder not help ASP.NET processing. The folder is ASP.NET
Provider of data storage itself the default location.
Note that the default ASP.NET account is granted full access to the folder. If you happen to change
ASP.NET account, we must ensure that the new account is granted the folder read / write access.
5. App_GlobalResources folder
6. App_LocalResources folder
7. App_Themes folder
App_Themes folder for the ASP.NET controls custom theme. Topics included in the App_Themes folder in a folder. By definition, a theme is a set of documents with the style information. Theme file in the folder content is compiled to produce a class, but such is the page called to programmatically set the theme of control style.
App_Themes application folder listed in the local theme. Applications can also be defined folder inherit the following global themes:
% WINDOWS% "Microsoft.NET" Framework "[version]" ASP.NETClientFiles "Themes
From the compiler point of view, the overall situation is no different themes and local themes. If the theme of a given name, there was not only the application's local theme, then there is the overall theme of the server machine, then the local themes prevail.
8. App_WebReferences folder
In Visual Studio. NET 2003, a need to access Web services, ASP.NET applications, through the "Add Web Reference" dialog box was appropriate. Wsdl file. Web services, WSDL (Web Service Description
Language) document, for the use of Web services from the page is not enough. ASP.NET page is ultimately a managed class, and the need to communicate with another managed class. Therefore, Web services, packaged by a proxy class. The proxy class is a Visual
Studio using the command-line tool wsdl.exe service created. The proxy class contains as much as possible the Web Methods Web service methods as much, and it combines the Web service's public interface definition of any custom data types.
This operation does not require developers to pay a high price. However, the developers obviously depends on the Visual Studio to generate the proxy class. If you can directly. Wsdl file on the application's directory tree somewhere, and let ASP.NET handle the rest of the task is not to be easier, more simple? This is precisely what App_WebReferences folders do.
It is to identify those used to describe the binding of Web services. Wsdl file, and run-time generated proxy class, so that ASP.NET pages can be type-safe way to place a call on Web services. App_WebReferences folder can contain subfolders. Subfolder name driver get in the end the proxy class namespace, and WSDL file defines the class name. For example, samples.wsdl files and ProsAspNet20 will create a subfolder called ProAspNet20.Samples the proxy class. The dynamic creation of the assembly is called App_WebReferences.xxx.dll, where xxx is a random sequence of characters.
Note the folder name file type
Include the application of any pre-generated the required assembly
Contains application-specific browser definition files, ASP.NET use it to identify the various browsers and determine their functions
. Cs,. Vb,. Xsd, custom file types include, as part of the application source files compiled class. When the page is requested, ASP.NET compiles the code folder. The code in that folder automatically in the application cited
. Mdb,. Mdf,. Xml
Includes Microsoft Office Access and SQL Express files and XML files or other data storage
Included in the localization of the application to use the resource file programmatically
The scope of the resource file that contains the page
. Skin,. CSS,. Xsl, subsidiary file contains a set of ASP.NET pages and controls define the appearance of documents