 |
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
 | This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

September 9th, 2010, 02:56 PM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 40
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
Chapter 15.page 532.step 5
Hi Imar. Im on page 532,chapter 15. At step 5 it says now save your changes and request signup.aspx. Unfortunately i get the following error:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first]
System.Net.Mail.MailCommand.CheckResponse(SmtpStat usCode statusCode, String response) +1061671
System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from) +41
System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) +101
System.Net.Mail.SmtpClient.Send(MailMessage message) +1480
System.Web.UI.WebControls.LoginUtil.SendPasswordMa il(String email, String userName, String password, MailDefinition mailDefinition, String defaultSubject, String defaultBody, OnSendingMailDelegate onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate, Control owner) +367
System.Web.UI.WebControls.CreateUserWizard.Attempt CreateUser() +547
System.Web.UI.WebControls.CreateUserWizard.OnNextB uttonClick(WizardNavigationEventArgs e) +102
System.Web.UI.WebControls.Wizard.OnBubbleEvent(Obj ect source, EventArgs e) +418
System.Web.UI.WebControls.CreateUserWizard.OnBubbl eEvent(Object source, EventArgs e) +161
System.Web.UI.WebControls.WizardChildTable.OnBubbl eEvent(Object source, EventArgs args) +19
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +166
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
My <smtp> does contain a valid email address. I mean i had everything working in chapter 9 with regards to email.
It does say in the book however that if your server requires you to use SSL i may habe a problem as i cannot set the EnableSSL property direcetly.
Is that the problem here??
Do i have to write code in the sendingMail event do you think thats what the problem is? If so could you give me an example of the code id need to write here. If that isnt the problem please let me know what you think is.
signup.aspx code:
Code:
<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="Sign-up.aspx.cs" Inherits="Sign_up" Title="Sign-Up" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
<MailDefinition BodyFileName="~/App_Data/Sign-UpConfirmation.txt"
Subject="Your new account at Salford Student Books">
</MailDefinition>
<WizardSteps>
<asp:CreateUserWizardStep runat="server" />
<asp:CompleteWizardStep runat="server" />
</WizardSteps>
</asp:CreateUserWizard>
</asp:Content>
By the way i am aware ive called the page sign-up rather than signup. Was just a preference.
Many thanks for any help.
|
|

September 10th, 2010, 03:12 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
The controls send their own mail messages and don't take the SSL settings into account. There are two solutions:
1. Upgrade your site to .NET 4 which enables you to configure SSL in the web.config
2. http://imar.spaanjaars.com/505/using...at-require-ssl
Hope this helps.
Cheers,
Imar
|
|

September 10th, 2010, 08:09 PM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 40
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
Hi Imar. How would i go about upgrading my site to 4.0? Could this have any negative repurcussions for messing the site up ive created for if its difficult to upgrade to 4.0.
I attempted your step 2 and followed your link. I tried using this code in the sending mail method:
Code:
protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
{
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.EnableSsl = true;
mySmtpClient.Send(e.Message);
e.Cancel = true;
}
I also attempted as per the recommendations on p.532 step 5 to use the same code that is used in the contactform.ascx. That didnt work either.
Here is the error im getting:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'SmtpClient' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 21: protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
Line 22: {
Line 23: SmtpClient mySmtpClient = new SmtpClient();
Line 24: mySmtpClient.EnableSsl = true;
Line 25: mySmtpClient.Send(e.Message);
Here is my code:
sign-up.as behind code:
Code:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Sign_up : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
{
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.EnableSsl = true;
mySmtpClient.Send(e.Message);
e.Cancel = true;
}
}
Any help or advice on how to get past this step 5 on page 532 would be appreciated.
Lee
|
|

September 11th, 2010, 02:41 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
The error message is staring you in the face:
Quote:
|
The type or namespace name 'SmtpClient' could not be found (are you missing a using directive or an assembly reference?)
|
You need to add a using statement for the System.Net.Mail namespace as explained on page 324, step 3.
Imar
|
|

September 13th, 2010, 02:40 PM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 40
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
Ive added a using system.net.mail; at the top of my sign-up.aspx code behind class but am still getting an error:
code for sign-up.aspx code behind:
Code:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Net.Mail;
public partial class Sign_up : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
{
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.EnableSsl = true;
mySmtpClient.Send(e.Message);
e.Cancel = true;
}
}
code for sign_up.aspx:
Code:
<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="Sign-up.aspx.cs" Inherits="Sign_up" Title="Sign-Up" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
oncreateduser="CreateUserWizard1_CreatedUser"
onsendingmail="CreateUserWizard1_SendingMail">
<MailDefinition BodyFileName="~/App_Data/Sign-UpConfirmation.txt"
Subject="Open your new account today">
</MailDefinition>
<WizardSteps>
<asp:CreateUserWizardStep runat="server" />
<asp:CompleteWizardStep runat="server" />
</WizardSteps>
</asp:CreateUserWizard>
</asp:Content>
error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1061: 'ASP.sign_up_aspx' does not contain a definition for 'CreateUserWizard1_CreatedUser' and no extension method 'CreateUserWizard1_CreatedUser' accepting a first argument of type 'ASP.sign_up_aspx' could be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 4: </asp:Content>
Line 5: <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
Line 6: <asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
Line 7: oncreateduser="CreateUserWizard1_CreatedUser"
Line 8: onsendingmail="CreateUserWizard1_SendingMail">
Source File: c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\WebSites\SALFORDBOOKSHOP\Sign-up.aspx Line: 6
Many thanks for the help
|
|

September 13th, 2010, 03:04 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Are you using me as your on-line debugger? ;-)
You'll get better and faster results if you know how to interpret error messages. Take a look at this:
Quote:
Compiler Error Message: CS1061: 'ASP.sign_up_aspx' does not contain a definition for 'CreateUserWizard1_CreatedUser' and no extension method 'CreateUserWizard1_CreatedUser' accepting a first argument of type 'ASP.sign_up_aspx' could be found (are you missing a using directive or an assembly reference?)
|
Isn't that exactly telling you what the problem is?
Imar
|
|

September 13th, 2010, 03:41 PM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 40
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
No im just completely new to programming hence buying your book. This is the first time ive had a go at making a site so error messages are pretty hard to decipher for someone like me. Ive added a using directive and am unsure what it means or requires me to do by telling me there is no definition or extension method accepting an argument of type ASP.sign_upaspx
Hopefully this will come with experiencing of seeing the same error messages come up.
|
|

September 13th, 2010, 04:10 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
No im just completely new to programming hence buying your book.
|
I understand that. But in order to succeed, you need to figure out a way to understand and interpret the error message so you can take action on them. .NET's error messages are typically very detailed, and together with the information from my book, I hope you can figure out what most of them mean. In this case, it's literally telling you what the problem is. In cases like this, this is what I do:
1. I read / Interpret the error. In this case, it's telling you that some code is expecting the presence of a CreateUserWizard1_CreatedUser method.
2. I copy and paste that name to the clipboard and paste it in the Find dialog of Visual Studio. For now, the current document will do, but for other issues you may want to search the entire site.
You'll quickly find this markup:
Code:
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
oncreateduser="CreateUserWizard1_CreatedUser"
onsendingmail="CreateUserWizard1_SendingMail">
This says something like: "If the CreateUserWizard is ready creating the user, then execute the CreateUserWizard1_CreatedUser method".Obviously, in order to execute a custom method like this, it needs to exist. It doesn't exist in your page, and thus you get the error.
Two ways to fix it:
1. If you don't need this method, simply remove the entire OnCreatedUser attribute and its value from the control. No attempt will then be made to call a method when the user is created.
2. If you do need it, create the method by double-clicking it in the Events category of the Properties Grid for the CreateUserWizard control as explained in the book.
Hope this helps,
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

September 13th, 2010, 04:19 PM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 40
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
Thanks for explaining in detail what the error message actually meant. Ive removed the onCreatedUser element and got it to successfully work.
Many thanks.
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Chapter 5 page 156 Example Step 4 |
NoraBelle |
BOOK: Professional Microsoft SQL Server 2008 Integration Services ISBN: 978-0-470-24795-2 |
1 |
August 2nd, 2010 03:29 PM |
| Chap 15 pg 532 |
tomche |
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 |
10 |
April 2nd, 2010 03:37 PM |
| Try it out, Chapter 20, page 684, step 3 |
ron-bgsu |
BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 |
0 |
October 28th, 2009 08:52 AM |
| Chapter 15, Page 532-533 |
Loophole3 |
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 |
2 |
September 13th, 2009 05:45 AM |
| Chapter 16 Try It Out Page 498 Step 7 |
workib |
BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 |
1 |
October 9th, 2008 08:22 PM |
|
 |