Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 8th, 2016, 05:39 PM
Authorized User
Points: 103, Level: 2
Points: 103, Level: 2 Points: 103, Level: 2 Points: 103, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2015
Location: Annandale, VA
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via Skype™ to trtyler
Default Exception Handling - Email Notiification

This is posted as a hint to anyone having trouble with sending the email message for an exceptions as outlined in Chapter 18.

For me, the code in the book worked perfectly on my local machine but when I deployed to my web host (MyindowsHosting.com) I could not get it to send the "exception emails" The code for the login response and contact response did work on the web site. I spent about a week trying to figure out how to get the "exception e-mail" to work and finally, out of desperation, tried the following:

I changed the code in the Global.asax module as follows:

1) Added <%@ Import Namespace="System.Net"%>

2) Made the following change in the Application_Error Handler:

Removed the following two statements:

// SmtpClient mySmtpClient = new SmtpClient();
// SmtpClient mySmtpClient = new SmtpClient("smtp.gmail.com", 587);

And replaced withthe following (The same code as in the Controls.
ContactForm.asax.cs)

// Required to change the code in "Beginning Asp.Net 4.5.1 in C# and VB"
// to the following in order for it to send mail on My WindowsHosting Site1

SmtpClient mySmtpClient = new SmtpClient("smtp.gmail.com", 587);
mySmtpClient.UseDefaultCredentials = false;
mySmtpClient.Credentials = new
NetworkCredential("trtyler@gmail.com", "*******");
mySmtpClient.EnableSsl = true;
mySmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
mySmtpClient.Send(myMessage);

This worked for me and I hope this hint may help someone else out.
Reply With Quote
The Following User Says Thank You to trtyler For This Useful Post:
Imar (August 13th, 2016)
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception Handling Fed BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 February 16th, 2010 04:49 PM
Exception handling codehelp C# 2008 aka C# 3.0 4 August 27th, 2009 07:46 AM
exception handling jay schumacher VB.NET 2002/2003 Basics 1 April 14th, 2006 08:40 AM
Exception handling aldwinenriquez General .NET 0 August 17th, 2005 06:13 PM



All times are GMT -4. The time now is 03:20 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.