Sideway
output.to from Sideway




Draft for Information Only

Content

ASP.NET @ Application Directives
  @ Application
   Syntax
   Attributes
  Attribute Values
  Remarks
  @ Import
   Syntax
   Attributes
  Remarks
  @ Assembly
   Syntax
   Attributes
  Remarks
  Source/Reference

ASP.NET @ Application Directives

The application directives for global application files with .asax file extension are @ Application, @ Import, and @ Assembly.

@ Application

The @ Application is used to defines application-specific attributes used by the ASP.NET application compiler, and appears only in application (.asax) files.

Syntax

<%@ Application attribute="value" [attribute=value … ] %>

Attributes

@ ApplicationKeywords of @ Application directive attributeSpecified keywords from a list of attribute name used to specify attribute of @ Application attribute. "value"The specified value of the specified attribute of @ Application attribute.

Attribute Values

CodeBehindSpecifies the name of a source code file that contains a class associated with the application class. This is ignored by the ASP.NET parser; it is used only at design time by integrated development environment (IDE) tools such as Microsoft Visual Studio 2005. Note: This attribute is included for compatibility with previous versions of ASP.NET, to implement the code-behind feature. In ASP.NET version 2.0, you should instead use the CodeFile attribute to specify the name of the source file, along with the Inherits attribute to specify the fully qualified name of the class. CompilerOptionsA string containing compiler options used to compile the page. In C# and Visual Basic, this is a sequence of compiler command-line switches. DescriptionA text description of the application class. This value is ignored by the ASP.NET parser. InheritsDefines a code-behind class for the application class to inherit. This can be any class derived from the HttpApplication class. Used with the CodeFile attribute, which contains the path to the source file for the code-behind class. LanguageSpecifies the language used when compiling all inline rendering (<% %> and <%= %>) and code declaration blocks within the application file. Values can represent any .NET Framework-supported language, including Visual Basic, C#, or JScript. Only one language can be used and specified per application file.

Remarks

  • The Description and Inherits attributes can be declared together in the same @ Application directive.
  • If code separation is used for the application class, the Inherits attribute must be used to specify the name of a code-behind class from which the application class will inherit.
  • Optionally, if you are using an IDE (such as Microsoft Visual Studio 2005) that provides tools for working with code separation source files in code projects, you can add the CodeFile attribute to specify the code-behind source file name.

@ Import

The @ Import directive is used to explicitly imports a namespace into an ASP.NET application file (such as a Web page, a user control, a master page, or a Global.asax file), making all classes and interfaces of the imported namespace available to the file. The imported namespace can be part of the .NET Framework class library or a user-defined namespace..

Syntax

<%@ Import namespace="value" %>

Attributes

@ ImportKeywords of @ Import directive namespaceThe fully qualified name of the namespace to import. This can include any of the namespaces included in the .NET Framework or a custom namespace. "value"The specified value of the namespace attribute of @ Import attribute.

Remarks

  • The @ Import directive cannot have more than one namespace attribute. To import multiple namespaces, use multiple @ Import directives.

  • A set of namespaces can be automatically imported into .aspx pages. The imported namespaces are defined in the machine-level Web.config file, within the <namespaces> section of the <pages> element. The following namespaces are automatically imported into all pages:

    • System
    • System.Collections
    • System.Collections.Specialized
    • System.Configuration
    • System.Text
    • System.Text.RegularExpressions
    • System.Web
    • System.Web.Caching
    • System.Web.Profile
    • System.Web.Security
    • System.Web.SessionState
    • System.Web.UI
    • System.Web.UI.HtmlControls
    • System.Web.UI.WebControls
    • System.Web.UI.WebControls.WebParts

@ Assembly

The @ Assembly directive is used to links an assembly to an ASP.NET application file (such as a Web page, a user control, a master page, or a Global.asax file) during compilation, making all the assembly's classes and interfaces available for use.

Syntax

<%@ Assembly Name="assemblyname" %>
<%@ Assembly Src="pathname" %>

Attributes

@ AssmemblyKeywords of @ Assmebly directive NameA string that represents the name of the assembly to link. Note: The assembly name does not include a file name extension. assemblynameA string that represents the name of the assembly to link. The specified assembly name does not include a file name extension. SrcThe path to a source file to dynamically compile and link against. Note: You must include either a Name or a Src attribute in an @ Assembly directive, but you cannot include both within the same directive. If you need to use both of these attributes, you must include multiple @ Assembly directives in the file. pathnameThe path to a source file to dynamically compile and link against.

Remarks

  • The compiler references the assembly at compile time, allowing early binding. After compilation of the requested ASP.NET file is complete, the assembly is loaded into the application domain, allowing late binding. The @ Assembly directive can be used in .aspx pages, .ascx files, .master pages and .asax files.
  • Assemblies that reside in your Web application's \Bin directory are automatically linked to ASP.NET files within that application. Such assemblies do not require the @ Assembly directive. You can disable this functionality by removing the following line from the <assemblies> section of your application's Web.config file: <add assembly="*"/>
  • As an alternative to using the @ Assemblydirective, you can use the Web.config file to link assemblies across an entire application.

Source/Reference

  • https://docs.microsoft.com/en-us/previous-versions/t8syafc7(v=vs.140)
  • https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/s42bzt8x(v=vs.100)
  • https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/eb44kack%28v%3dvs.100%29
  • https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/d864zc1k%28v%3dvs.100%29

©sideway
close

References

  1. Active Server Pages, http://msdn.microsoft.com/en-us/library/aa286483.aspx, updated 20Dec2012
  2. ASP Overview, http://msdn.microsoft.com/en-us/library/ms524929%28v=vs.90%29.aspx, updated 21Dec2012
  3. ASP Best Practices, http://technet.microsoft.com/en-us/library/cc939157.aspx, updated 15Apr2013
  4. ASP Built-in Objects, http://msdn.microsoft.com/en-us/library/ie/ms524716(v=vs.90).aspx, updated 20Dec2012
  5. Response Object, http://msdn.microsoft.com/en-us/library/ms525405(v=vs.90).aspx, updated 20Dec2012
  6. Request Object, http://msdn.microsoft.com/en-us/library/ms524948(v=vs.90).aspx, updated 20Dec2012
  7. Server Object (IIS), http://msdn.microsoft.com/en-us/library/ms525541(v=vs.90).aspx, updated 20Dec2012
  8. Application Object (IIS), http://msdn.microsoft.com/en-us/library/ms525360(v=vs.90).aspx, updated 20Dec2012
  9. Session Object (IIS), http://msdn.microsoft.com/en-us/library/ms524319(8v=vs.90).aspx, updated 20Dec2012
  10. ASPError Object, http://msdn.microsoft.com/en-us/library/ms524942(v=vs.90).aspx, updated 20Dec2012
  11. ObjectContext Object (IIS), http://msdn.microsoft.com/en-us/library/ms525667(v=vs.90).aspx, updated 20Dec2012
  12. Debugging Global.asa Files, http://msdn.microsoft.com/en-us/library/aa291249(v=vs.71).aspx, updated 15Apr2013
  13. How to: Debug Global.asa files, http://msdn.microsoft.com/en-us/library/ms241868(v=vs.80).aspx, updated 15Apr2013
  14. Calling COM Components from ASP Pages, http://msdn.microsoft.com/en-us/library/ms524620(v=VS.90).aspx, updated 15Apr2013
  15. IIS ASP Scripting Reference, http://msdn.microsoft.com/en-us/library/ms524664(v=vs.90).aspx, updated 15Apr2013
  16. ASP Keywords, http://msdn.microsoft.com/en-us/library/ms524672(v=vs.90).aspx, updated 15Apr2013
  17. Creating Simple ASP Pages, http://msdn.microsoft.com/en-us/library/ms524741(v=vs.90).aspx, updated 15Apr2013
  18. Including Files in ASP Applications, http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx, updated 15Apr2013
  19. ASP Overview, http://msdn.microsoft.com/en-us/library/ms524929(v=vs.90).aspx, updated 15Apr2013
  20. FileSystemObject Object, http://msdn.microsoft.com/en-us/library/z9ty6h50(v=vs.84).aspx, updated 14Mayr2013
  21. http://msdn.microsoft.com/en-us/library/windows/desktop/ms675944(v=vs.85).aspx, ADO Object Model, updated 15Apr2013
  22. ADO Fundamentals, http://msdn.microsoft.com/en-us/library/windows/desktop/ms680928(v=vs.85).aspx, updated 14Mayr2013
close

ID: 190700003 Last Updated: 2019/7/3 Revision: Ref:

IMAGE

Home (5)

Business

Management

HBR (3)

Information

Recreation

Hobbies (7)

Culture

Chinese (1097)

English (336)

Reference (66)

Computer

Hardware (149)

Software

Application (187)

Digitization (24)

Numeric (19)

Programming

Web (618)new

CSS (SC)

ASP.NET (SC)

HTML

Knowledge Base

Common Color (SC)

Html Entity (Unicode) (SC)

Html 401 Special (SC)

OS (388)new

MS Windows

Windows10 (SC)

.NET Framework (SC)

DeskTop (7)

Knowledge

Mathematics

Formulas (8)

Number Theory (206)

Algebra (20)

Trigonometry (18)

Geometry (18)

Calculus (67)

Complex Analysis (21)

Engineering

Tables (8)

Mechanical

Mechanics (1)

Rigid Bodies

Statics (92)

Dynamics (37)

Fluid (5)

Fluid Kinematics (5)

Control

Process Control (1)

Acoustics (19)

FiniteElement (2)

Biology (1)

Geography (1)


Copyright © 2000-2019 Sideway . All rights reserved Disclaimers last modified on 10 Feb 2019