Wrox Programmer Forums
|
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
 
Old September 12th, 2009, 05:29 PM
Registered User
 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 15, Page 532-533

Good Afternoon,

I'm working on this section of chapter 15 and have read the previous threads about email / SSL issues but I'm not sure this is an SSL issue.

I have looked up the error using the F1-Help functionality in Visual Stuido 2008 and it sounds like it's a SQL problem.

This is the stack trace I'm getting when I enter the sign-up information into the sign-up wizard and hit the "Create User" button.

An existing connection was forcibly closed by the remote host

Stack Trace:


[SocketException (0x2746): An existing connection was forcibly closed by the remote host]
System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) +73
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +131

[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +294
System.Net.DelegatedStream.Read(Byte[] buffer, Int32 offset, Int32 count) +42
System.Net.BufferedReadStream.Read(Byte[] buffer, Int32 offset, Int32 count) +105
System.Net.Mail.SmtpReplyReaderFactory.ReadLines(S mtpReplyReader caller, Boolean oneLine) +224
System.Net.Mail.SmtpReplyReaderFactory.ReadLine(Sm tpReplyReader caller) +16
System.Net.Mail.SmtpConnection.GetConnection(Strin g host, Int32 port) +642
System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +159
System.Net.Mail.SmtpClient.GetConnection() +35
System.Net.Mail.SmtpClient.Send(MailMessage message) +1213

[SmtpException: Failure sending mail.]
System.Net.Mail.SmtpClient.Send(MailMessage message) +1531
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


If this is due to the SSL issue just let me know and I'll go back to those threads and get this resolved.

Thanks,

Ernie

{edit} I get this error when I use my code as well as when I used the downloaded code for chapter 15.
 
Old September 12th, 2009, 06:55 PM
Registered User
 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

By the off chance that this was an SSL issue I added the following code in my SignUp.aspx code behind page:

Protected Sub CreateUserWizard1_SendingMail..............
Dim mySmtpClient As SmtpClient = New SmtpClient()
mySmtpClient.EnableSsl = True
mySmtpClient.Send(e.Message)
e.Cancel = True
End Sub

I also added an Imports System.Net.Mail statement to the top of the code behind page.

I still received the error listed in the original post.

Thanks,

Ernie

{edit} I used the debugger and walked through the snippet above and found that the error generated when it hit the mySmtpClient.Send(e.Message) line. Since it's throwing the exception both with and without this code something must be happening right as it's about to send the email. As I walked through the debugger I watched as it pulled the .txt file for the email and inserted the user's name, etc., and it actually created the account for the user - saw the accounts when I was doing the rolemanager stuff later in the chapter. So it's just bombing when it tries to send the created email.

Last edited by Loophole3; September 13th, 2009 at 12:27 AM..
 
Old September 13th, 2009, 05:45 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Ernie,

Yes, it's indeed an SMTP error. You can see in the stack trace that it goes into System.Net.Mail.SmtpClient.Send and then crashes.

There could be a number of reasons for this problem. For example, you may be using the wrong SMTP server. Or you server indeed requires SSL and you're not providing the correct port number. Or maybe a firewall is set up to block SMTP.

Which SMTP server are you using? If you're using an external one (ISP, Gmail etc) does the external party provide more information about required settings?

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
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
Chapter 1 errata - Northwind - page 15 MikeTheFid BOOK: Professional ADO.NET 3.5 with LINQ and the Entity Framework ISBN: 978-0-470-22988-0 0 July 29th, 2009 11:03 AM
Chapter 15 p.774 at the top of page shade cat BOOK: Ivor Horton's Beginning Visual C++ 2005 0 June 5th, 2007 03:04 PM
Unclear instructions in chapter 1 page 15 Merocal BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 17 January 14th, 2007 06:54 PM
Chapter 15 Page 711 JOHNW BOOK: Beginning ASP 3.0 3 January 14th, 2004 11:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.