Components ASP.Net

<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Web.Mail" %>

Sub SubmitBtn_Click(Sender As Object, E As EventArgs)
    Dim TheMessage as String
    Dim TheMailMessage as New MailMessage
    Dim TheAttachment as MailAttachment
    TheMessage = txtName.Text _
        & ": Attached to this email is the " _
        & "file you requested."
    TheMailMessage.From = "us@a.com"
    TheMailMessage.To = txtEmailAddress.Text
    TheMailMessage.Subject = "File Request"
    TheMailMessage.Body = TheMessage
    TheAttachment = New MailAttachment( _
        Server.MapPath(ddlFile.SelectedItem.Value))
    TheMailMessage.Attachments.Add(TheAttachment)
    SmtpMail.SmtpServer = "localhost"
    SmtpMail.Send(TheMailMessage)
    
    lblMessage1.Text = "The file requested has been sent " _
        & "to the email address you entered.
Enter Your Name"
End Sub



File Request Sample Site




    id="lblMessage1"
    runat="Server"
    Text="Enter Your Name"
/>


    id="txtName"
    runat="server"
    MaxLength=50
/>



    id="lblMessage2"
    runat="Server"
    Text="And Your Email Address"
/>


    id="txtEmailAddress"
    runat="server"
    MaxLength=50
/>



    id="lblMessage3"
    runat="Server"
    Text="Select the file you wish to download"
/>


    id="ddlFile"
    runat="server"
>
            Value="Catalog.txt"
        Text="Catalog"
    />
            Value="StoreLocations.txt"
        Text="Store Locations"
    />




    id="butOK"
    text="Send File"
    Type="Submit"
    OnClick="SubmitBtn_Click" 
    runat="server"
/>