Import Directives
<%@ Import Namespace="System.Web.Mail" %>
Dim mailMessage As SmtpMail
Dim mailMessage As System.Web.Mail.SmtpMail
- By default, only certain namespaces are automatically imported into an ASP.NET page.
- If we want to refer to a class that isn't a member of one of the default namespaces, then explicitly import the namespace of the class or use the fully qualified name of the class.
- For example, suppose we want to send an email from an ASP.NET page by using the Send method of the SmtpMail class.
- The SmtpMail class is contained in the System.Web.Mail namespace.
- This is not one of the default namespaces imported into an ASP.NET page.
- The easiest way to use the SmtpMail class is to add an Import directive to your ASP.NET page to import the necessary namespace.
<%@ Import Namespace="System.Web.Mail" %>
Dim mailMessage As SmtpMail
- Instead of importing the System.Web.Mail namespace with the import directive, we can alternatively use its fully qualified name.
Dim mailMessage As System.Web.Mail.SmtpMail
No comments:
Post a Comment