Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
<%@ Import namespace="value" %>
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:
The following code example imports the .NET Framework base-class namespace System.Net and the user-defined namespace Grocery
.
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="Grocery" %>
Please sign in to use this experience.
Sign in