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 fully qualified name of the namespace to import. This can include any of the namespaces included in the .NET Framework or a custom namespace.
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
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" %>