Compartir a través de


@ Import

Explicitly imports a namespace into a page, making all classes and interfaces of the imported namespace available to the page. The imported namespace can be part of the .NET Framework class library or a user-defined namespace.

<%@ Import namespace="value" %>

Attributes

  • namespace
    The name of the namespace to import to the page. This can include any of the namespaces included in the .NET Framework or a custom namespace.

Remarks

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

The following namespaces are automatically imported into all pages:

Example

The following code imports the .NET Framework base-class namespace System.Net and the user-defined namespace Grocery:

<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="Grocery" %>

See Also

ASP.NET Web Forms Syntax | Directive Syntax