Meanings of various folders in ASP. NET Projects

Source: Internet
Author: User
Tags sql server express
Meanings of various folders in ASP. NET projects (9php.com)

1. Bin folder
Bin folder contains applications Program Required (9php.com) for controls, components, or any other (9php.com) to be referenced Code (9php.com. Any. DLL files in the directory (9php.com) will be automatically linked to the application. If unnecessary (9php.com) or expired (9php.com) files are left in the folder, the risk of "ambiguous reference" exception (9php.com) may occur. In other words, if two different (9php.com) Assembly defines the same (9php.com) class (the same (9php.com) namespace and name), then ASP. net Runtime Library cannot decide which assembly should be used, thus throwing an exception. During development, this is a common (9php.com) error when we rename a project or an assembly (9php.com. To avoid this error, do not keep any unnecessary (9php.com) Assembly in this folder, or at least from the configuration file (9php.com) <assemblies> Delete the following code lines:
<Add Assembly = "*"/>
In all the folders listed in table 1.10 (9php.com), only Bin can be recognized by ASP. NET 1. x applications. This folder is mandatory (9php.com ).
2. app_browser folder
The optional (9php.com) folder contains the. Browser file .. The Browser file describes the features and functions of browsers (either mobile browsers or desktop browsers. ASP. NET has installed a large number of. browser files in the (9php.com) config \ Browser folder under the installation path, which are shared by all applications. We just put the Browser file unique to the current application (9php.com) in the app_browser folder .. The content of the browser file (9php.com) is instantly and dynamically compiled to provide the newest (9php.com) browser information to the ASP. NET Runtime Library.
Let's talk about a scenario where a custom (9php.com). Browser file may be helpful (9php.com. Suppose the application uses a (9php.com) control that cannot be effectively rendered in a browser. When the host page is displayed in the specified (9php.com) browser, you can write a. Browser file to force ASP. NET to generate the control using a different (9php.com) adapter.
<Browsers>
<Browser id = "browserid">
<Controladapters>
<Adapter C
Adaptertype = "samples. adapters. customcontroladapter"/>
</Controladapters>
</Browser>
</Browsers>
Suppose browserid and ASP. if one of the standard browsers identified by. Net (9php.com) matches, as shown above (9php.com ). the Browser file indicates that customcontroladapter is used to render customcontrol in the specified (9php.com) browser.
3. app_code folder
The app_code folder is located in the root directory of the Web application. It stores all the (9php.com) class files that should be dynamically compiled as part of the application (9php.com. These class files are automatically linked to the application without adding any explicit commands or declarations on the page to create dependencies. The (9php.com) class files placed in the app_code folder can contain any identifiable (9php.com) Asp. NET components-custom controls, helper classes, build providers, business classes, custom providers, HTTP processing programs, and so on.
Note that during development, changes to the app_code folder (9php.com) will cause the entire application to be re-compiled. This may be undesirable and time-consuming for large projects. To this end, we encourage you to modularize the code into different (9php.com) class libraries and organize the code in a logically related (9php.com) class set. Most of the app-specific (9php.com) helper classes should be placed in the app_code folder.
All class files (9php.com) stored in the app_code folder should use the same (9php.com) language. If a class file is written in two or more languages, you must create a 9php.com subdirectory in a specific language to contain the (9php.com) Class written in each language. Once these class files are organized by language, you must add a setting for each subdirectory in the web. config file:
<Compilation>
<Codesubdirectories>
<Add directoryname = "vbfolder"/>
</Codesubdirectories>
</Compilation>
The important (9php.com) is that the sub-directories of a specific language (9php.com) should be in the web. the config file is registered. Otherwise, no matter which folder they belong to, all the files (9php.com) in the app_code folder will be compiled into a separate (9php.com) assembly. The preceding configuration script describes the situation where all (9php.com) C # files are stored in the root directory of the app_code folder (9php.com), and several Visual Basic files are stored.. Net files are moved to the vbfolder directory. If the (9php.com) directory mentioned in the <codesubdirectories> section does not exist, a compilation error is returned.
The (9php.com) file in the app_code root folder is compiled into the app_code_xxx.dll assembly, where XXX is a random (9php.com) character sequence. The (9php.com) file in a given subdirectory will be compiled into a (9php.com) dynamically created (9php.com) Assembly named app_subcode_xxx_yyy.dll, where xxx indicates the (9php.com) Name of the subdirectory, YYY is a random character sequence. The <codesubdirectories> section is valid only when settings are made in the (9php.com) web. config file in the application root directory.
Place an assemblyinfo. CS file in the app_code directory or any other subdirectory to create a strongly-named (9php.com) assembly. Obviously, if the folder contains the Visual Basic. Net file, the assemblyinfo. VB file will be used. The assembly configuration file can reference A. SNK file to save the (9php.com) key with a strong name.
Note: To set a strong name for an assembly, you must first obtain a public/private key pair. You can obtain such a key pair by using the strong name (strong name1_tool (sn.exe. The strong name tool is one of the (9php.com) SDK binary files we can find in the. NET Framework (9php.com) installation path. A key pair file usually has a. SNK extension. You can save the file to an application folder and reference it in the assemblyinfo. CS file, as shown below:
[Assembly: assemblykeyfileattribute (@ "yourkeypair. SNK")]
Note: Visual Basic. net is used to find the key file in the (9php.com) directory that contains Visual Studio solution, while the C # compiler searches for the key file in the (9php.com) directory that contains the binary file. According to this, we can use this attribute to adjust the path we use (9php.com), or place the key file in the appropriate (9php.com) folder.
In any subsequent (9php.com) re-generation, the Assembly (9php.com) name will change. At the same time, when the old (9php.com) appdomain request ends, the old (9php.com) assembly will be deleted.
The app_code Folder does not only contain class files. In particular, it can contain and automatically process the (9php.com) XSD file representing the data architecture. When an XSD file is added to this folder, the compiler parses it into a data set class (9php.com) and adds it to the application scope. In ASP. NET 1. X, this job is directed by Visual Studio .netand completed by a command line program (xsd.exe) (9php.com ).
Use web. when the config file registers a component (for example, a custom (9php.com) server control or a custom (9php.com) HTTP handler, you must specify the name of the (9php.com) Assembly containing the Code. If the component is defined in the app_code folder, what name should be used to indicate the assembly? In this case, you only need to ignore the assembly information and specify the complete (9php.com) class name. ASP. net Runtime Library will try to load the class from any mounted (9php.com) Assembly, including the (9php.com) Assembly dynamically created for the app_code folder.
4. app_data folder
The app_data folder should contain the local data storage of the application (9php.com. It usually contains data storage in the form of files (such as Microsoft Access or Microsoft SQL Server express database, XML files, text files, and any other files supported by the application (9php.com. The content of this folder cannot be processed by ASP. NET. This folder is the default location where the ASP. NET provider stores its own data (9php.com.
Note that by default, the ASP. NET account is granted full access to the folder (9php.com. If you happen to change your ASP. NET account, make sure that the new account is granted read/write access to the folder (9php.com.
5. app_globalresources folder
Like other applications, ASP. NET applications can also use resources, and resources should generally be used. A resource is an effective method for isolating 9php.com (9php.com) on the application user interface. Generally, resources are program-related (9php.com) unexecutable (9php.com) texts. Typical (9php.com) resources include images, icons, text, and ancillary files, but any serializable (9php.com) object can also be seen as a resource source. Application resources are stored outside the application (9php.com) so that they can be re-compiled and replaced without affecting or re-compiling the application itself (9php.com.
An ASP. NET application requires a major assembly to save the default (9php.com) or neutral (9php.com) resources of the application. In addition, we need to deploy many ancillary assemblies that each contain the 9php.com localized resources of a certain culture that we need to support. In ASP. NET 1.x, it is a little troublesome to compile the (9php.com) resources in an assembly. You need to manually compile XML (9php.com)-based resource files (those with. Res extensions (9php.com) into. Resources binary files. These files can be embedded into a. Net executable file or compiled into ancillary assembly. Use the resource file Generator program resgen.exe to convert text and XML-based (9php.com) resource files into. resource files. The resource file name complies with the naming conventions of basename. culturename. Resource, where basename is usually the name of the application (9php.com:
Resgen.exe proaspnetw.resx proaspnetw.it. Resources
After the. Resource file is created, it should be embedded into a set of programs, and can even be used as a resource container. To embed a resource file into an affiliated program concentration, you can use the connector tool (al.exe) of the program set ). On the command line, specify the (9php.com) culture used by the Assembly (for example, 9php.com it in the following example, which represents Italy) and the name.
Al/out: proaspnetw.resources. dll/C: It/embed: proaspnetw.it. Resources
After the affiliated Assembly is compiled, they will have the same (9php.com) Name. Deploy them to different (9php.com) subdirectories and name them by culture.
Fortunately (9php.com), for ASP. NET 2.0, the (9php.com) era of ancillary assembly is gone forever. More accurately, the affiliated Assembly still exists, but because app_globalresources retains folders, they have become a thing of the past for developers (9php.com.
The (9php.com) Any located (9php.com). resx file in this folder is automatically compiled into a subsidiary program set .. The (9php.com) Name of the resx file contains cultural information to help generate the (9php.com) Assembly of the ASP. NET Runtime Library environment. The following file: resources. resx, resources. it. resx, resources. fr. resx: generate a neutral assembly and a (9php.com) Ancillary Assembly suitable for Italian (Italian) and French (French) cultures. If no specific language is required, the neutral assembly is the default (9php.com) cultural resource.
The (9php.com) resource file in the app_globalresources folder is a global resource of the application (9php.com), so it can be referenced from any page. Compared with ASP. NET 1.x, resource reading results are greatly simplified:
<Asp: Label runat = "server" text = "<% $ resources: resxfile, myresname %>"/>
You can use the latest (9php.com) resources (9php.com) $-expression to bind a global resource in the declared (9php.com) mode (Chapter 5th will detail $-expression ). This expression includes two parameters: the (9php.com) Name of the. resx resource file (without the extension) and the (9php.com) Name of the (9php.com) resource to be retrieved. Use the following code to access resources by programming (9php.com:
Httpcontext. getglobalresourceobject (resxfile, myresname)
Both parameters are strings and have the same effect as the $-expression (9php.com) parameter (9php.com. In addition, the $-expression resources (9php.com) implements the internal use of getglobalresourceobject.
6. app_localresources folder
The app_localresources folder is located in a sub-directory (9php.com) under the (9php.com) folder containing some ASP. NET pages. This folder can be filled with the (9php.com). resx file named on the (9php.com) page in the upper-level directory in the directory structure. Assume that the parent folder contains test. aspx, you can find some available (9php.com) resource files in the app_localresources folder as follows: test. aspx. resx, test. aspx. it. resx and test. aspx. fr. resx. Obviously, the resources stored in the preceding file (9php.com) only have an impact on the test. ASPX page. Therefore, they can only be seen on the linked (9php.com) page (they can be used ).
How to access a page's unique (9php.com) resources? For programming access, you can use the following code:
Httpcontext. getlocalresourceobject ("/proaspnet20/respage. aspx ",
"Pageresource1.title ")
The third parameter indicates the virtual path of the page, and the third parameter indicates the Resource Name. For declarative access, use the meta: resourcekey attribute. For example,
<Asp: button runat = "server" meta: resourcekey = "buttonresource1"/>
This statement associates a unique (9php.com) Resource key with a specified button instance. The local file. resx contains the (9php.com) entries in the prefix. Name format. The prefix is the resource key, and the name is the (9php.com) attribute name bound to the control. To assign the button a localized title (Text attribute), you only need to create a buttonresource1.text entry in the resource file.
The (9php.com) resource files in local and global resource folders are compiled to create the (9php.com) class of the ancillary assembly. The final result (9php.com) is that the developer creates the. resx file and tests the page. The ASP. NET compilation mechanism will complete other work.
7. app_themes folder
The app_themes folder defines the topic for the ASP. NET control. The topic contains a folder (9php.com) in the app_themes folder. According to the definition, a topic is a group of (9php.com) files with style information. The content of the (9php.com) file in the theme folder is compiled to generate a class, and the class is called by the page to set the (9php.com) style of the theme control in a programmatic (9php.com) way.
The app_themes folder lists the local topics of the application (9php.com. The application can also inherit the global theme (9php.com) defined in the following folder:
% WINDOWS % \ Microsoft. NET \ framework \ [version] \ ASP. netclientfiles \ themes
From the perspective of compiling (9php.com), there is no difference between a global topic and a local topic. If a topic with a given name (9php.com) exists both the local topic of the application (9php.com) and the global topic of the server machine (9php.com), the local topic is preferred.
8. app_webreferences folder Niu Base
In Visual Studio. NET 2003, A (9php.com) Asp.. NET application, the corresponding (9php.com) will be obtained through the "add web reference" dialog box ). the WSDL file. For the Web Service (9php.com) WSDL (Web Service Description Language) document, it is not enough to use the Web service from the page (9php.com ). The ASP. NET page is eventually a Managed class and needs to communicate with another Managed class. Therefore, a Web Service is encapsulated by a proxy class. This proxy class is created by visual studiousing the command line tool wsdl.exe (9php.com) Service (9php.com ). The proxy class should include as many (9php.com) methods as the web method of the web service provider (9php.com) as possible, and it combines the 9php.com public interface defined by the Web Service (9php.com) any custom (9php.com) data type.
This operation does not have to be costly for developers (9php.com. However, developers obviously need to rely on Visual Studio to generate proxy classes. If you can directly. the WSDL file is placed somewhere in the (9php.com) directory tree of the application, and ASP. net to process other (9php.com) tasks. Isn't this easier and easier? This is exactly what the app_webreferences folder is going to do (9php.com.
It identifies the (9php.com) web services used to describe the bound (9php.com ). the WSDL file and generate the runtime proxy class for ASP.. NET page can be placed in a type-safe (9php.com) Way to call Web Services (9php.com. The app_webreferences folder can contain subfolders. The (9php.com) Name of the sub-Folder drives the final namespace of the (9php.com) proxy class (9php.com), while the WSDL file defines the class name. For example, the samples. WSDL file and the prosaspnet20 sub-folder will create a (9php.com) proxy class called proaspnet#samples. The (9php.com) Assembly created in this dynamic state is called app_webreferences.xxx.dll, where XXX is a random (9php.com) character sequence.
Folder name
File Type
Note

Bin
. Dll
Contains any pre-generated (9php.com) assembly required by the application

App_browsers
. Browser
Contains the browser definition file (9php.com) specific to the application. ASP. NET uses it to identify various browsers and determine their (9php.com) features 97 xxoo

App_code
. CS,. VB,. XSD, and custom (9php.com) file types
Contains the (9php.com) source file of the (9php.com) Class compiled as part of the application (9php.com. When the page is requested, ASP. NET compiles the (9php.com) code in this folder. The (9php.com) code in this folder is automatically referenced in the Application

App_data
. Mdb,. MDF,. xml
Contains Microsoft Office Access and SQL express files and XML files or other data storage

App_globalresources
. Resx
(9php.com) resource file included in the Localization Application for programming

App_localresources
. Resx
(9php.com) resource file containing the page range

App_themes
. Skin,. CSS,. XSL, and ancillary files
Contains a set of (9php.com) files that define the appearance of ASP. NET pages and controls

App_webreferences
. WSDL
Contains the (9php.com) WSDL file used to generate the proxy class, and other (9php.com) files related to the use of web services in applications

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.