Web Design and Development Forums

Creating a Confirmation Page and E-Mail

This is a discussion on "Creating a Confirmation Page and E-Mail" within the ASP.NET Forum section. This forum, and the thread "Creating a Confirmation Page and E-Mail are both part of the Program Your Website category.


Go Back   Webforumz.com > Program Your Website > ASP.NET Forum

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Oct 24th, 2007, 18:16   #1 (permalink)
 
Join Date: Aug 2003
Location: Castle Rock, CO
Age: 36
Posts: 177
Creating a Confirmation Page and E-Mail

For training purposes, I would like to have two pages.

Now having said that, this is what I have so far:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="C#" %>

<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>E-Mail Address</title>
<style type="text/css">
label,input {
      display: block;
      float: left;
      margin-bottom: 10px;
}
input, select, textarea
{
      border: solid 1px #000;
      background-color: #fff;
      font-family: Verdana, Helvetica, Arial, sans-serif;
      font-size: 1.0em;
}
label {
      text-align: right;
      width: 125px;
      padding-right: 20px;
}

br {
      clear: left;
}
</style>

</head>

<body>

<form id="form1" runat="server" method="post" action="confirm.aspx">
<label>Name:</label>
<asp:TextBox runat="server" id="name"></asp:TextBox>
<asp:RegularExpressionValidator runat="server" ErrorMessage="Please Enter Your Name" id="RegularExpressionValidator2" ControlToValidate="name" Display="Dynamic">
</asp:RegularExpressionValidator>
<br />
      <label>E-Mail:</label>
      <asp:TextBox runat="server" id="email"></asp:TextBox>
      <asp:RequiredFieldValidator runat="server" ErrorMessage="Please Enter Your E-Mail Address" id="RequiredFieldValidator1" ControlToValidate="email" Display="Dynamic">
      </asp:RequiredFieldValidator>
      <asp:RegularExpressionValidator runat="server" ErrorMessage="Please Check Your E-Mail Address" id="RegularExpressionValidator3" ControlToValidate="email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
      </asp:RegularExpressionValidator>
      <br />
      <label>Message:</label>
      <asp:TextBox runat="server" id="message" TextMode="MultiLine" style="height: 125px"></asp:TextBox>
      <br />
      <br />
      <asp:Button runat="server" Text="Submit" id="Submit" />
</form>

</body>

</html>
in the contact.aspx page. This code was built using Expression Web so I am hoping it is pretty good / correct. While I understand some of this might not be that great of .NET code, I would like to leave most as is unless absolutely necessary.

Now in my confirm.aspx page, I would like for it to say

Thank you <name> for contacting us. We will be in touch soon.
(with name being replaced with the name that was entered into the form.aspx page).

Now, if there was an error, maybe something like:
Sorry, there was an error, please click here to re-enter your information.

What I have so far is:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Text" %>

<script runat="server">

      protected void Page_Load(object sender, EventArgs e)
      {
            
            if (IsPostBack)
            {
                  
                  System.Net.Mail.SmtpClient sc = new System.Net.Mail.SmtpClient("mail.example.org");
                  System.Text.StringBuilder sb = new StringBuilder();
            System.Net.Mail. msg = null;
                  
                  sb.Append("E-Mail from: " + txtname.Text + "\n");
                  sb.Append("E-Mail Address   : " + txtemail.Text + "\n");
                  sb.Append("Message   : " + txtmessage.Text + "\
                  
                  try
                  {
                        msg = new System.Net.Mail.MailMessage(txtEmail.Text 
                              "crb@example.org", "Message from your Web Site", 
                              sb.ToString());
                        
                        sc.Send(msg);
                  }
                  catch(Exception ex)
                  finally
                  {
                  
                        if (msg != null)
                        {
                              msg.Dispose();                        
                        }
                           
                  }
            
            }

</script>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
</head>

<body>

Thank you for your message.

else
//
An error occurred

</body>

</html>
Now I understand that I can use some things like
Code: Select all
<%@ Import Namespace="System.Net.Mail" %>
to replace it in the code, but for now, I would like to stay away from that until a bit later.

I have done this with ASP and using the JMail ASP component, but I would like to do this in .NET on two pages (contact.aspx and confirm.aspx)

Thank you!
__________________
Corey
Accept Credit Cards | Promo | Toll Free Numbers
Corey Bryant is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Advice on creating a members only page Oak PHP Forum 3 Feb 13th, 2008 22:13
problem with images when sending html page by mail juanb007 HTML Forum 4 Apr 29th, 2007 03:25
help creating a login and logout page geyids PHP Forum 14 Mar 26th, 2007 06:35
Booking Confirmation Page biggieuk JavaScript Forum 2 Nov 14th, 2006 10:10
ASP Mail To Page won't work dunaway ASP Forum 1 May 7th, 2004 18:10



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 13:55.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59