Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 July 6th, 2012, 09:34 PM
Registered User
 
Join Date: Jul 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sending Email Messages

I am a student at Grantham University and I had difficulty in getting an email to send off from and to my Gmail account during the exercises in chapter 9. Before going on to the next exercises I decided to do some searching around on the internet to try and find the answer in combination with the book and code we were supposed to use. Although I did not find the answer spelled out for me, I did find my answer. In the code snippets that were put into the book for the web.config file:

<network enableSsl="true" userName="[email protected]" password="yourpassword" host="smtp.gmail.com" />

this was referred to as the snippet if you use gmail, after this paragraph a small line indicating that if Ssl is used to check with your host for specific requirements. Assuming that the code provided was what was exactly needed for Gmail, I thought nothing of it. The code does not say where or how to insert the port and the setup for POP mails at Gmail says to use 465. The common ports are 465 and 587 and 587 is a backup. I added the 465 many times inside this snippet with failure and thinking that I was not doing the right thing, however with exausted attempts I tried the backup of 587 and it worked. My thought for the code to avoid confusion will be this:

<network enableSsl="true" userName="[email protected]" password="yourpassword" host="smtp.gmail.com" port="#" />

It was well explained to input your information in the other areas but this small addition could be added and help other students or novice web developers.
 
Old July 7th, 2012, 02:33 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 there,

Thanks for bringing this up. It was indeed confusing in the 4.0 version of the book. For the upcoming 4.5 version I updated the text to this:

The port number varies from server to server. In some cases you can leave out the port attribute and the SmtpClient will use the default port number (which is 25). Other port numbers that are frequently used include 465 and 587.

Some mail servers — like the one supplied by Gmail — require you to use SSL, a technique that encrypts the data going to the mail server to improve security. In ASP.NET prior to version 4, you had to enable SSL programmatically in your own code. Fortunately, with the inclusion of the enableSsl attribute on the <network /> element, this is no longer the case. To use a Gmail server or any other mail server that requires SSL, you use a <network /> element that looks like this:

Code:
 
<network enableSsl="true" host="smtp.gmail.com" password="YourPassword" 
               userName="[email protected]" port="587" />
Don’t forget to enter your password and user name — which in the case of Gmail is your full Gmail e-mail address.

Hopefully, this makes it clear what to do for Gmail and other mail servers.

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!
 
Old July 16th, 2012, 03:01 PM
Registered User
 
Join Date: Jul 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Another issue

Thanks for the response to the original post. I am glad to see that it was already being addressed. I have found another issue that is probably being addressed already but I would rather throw it out here just in case. If it has not been realized already, it may be just the help that someone needs to figure out what is going on in their code.

A lot of the exercises go from one point to another and don't bring themselves back to each other except in rare occasions. After doing chapter exercises for some time, I came to chapter 14 and the exercise for "Inserting and Deleting Data with the ListView Control." The last step here has you switch to the "DarkGrey" theme. I had noticed that this specific theme had not been working correctly for some time but since my homework only relied on what code was being used currently, I had no need to figure out why it was only working on my homepage. I figured that it was some coding error or deletion on my part. It ended up, not being something that I did, but something that I was not doing.

What I was missing was Step 6 from exercise "Creating a Base Page" in chapter 6. This step has you use the Find and Replace function to replace all of the System.Web.UI.Page in the Code Behind. After 8 chapters of reading and other coding I had forgot that I needed to do that in order to have a consistent ability to change themes on my site. There was also no reminder to do such a thing, like most of the exercises have repeating concepts which work well with building a memory to do things in a certain manner. I am not saying that it needs to be in every exercise to do so, but a reminder of how to do so when building an .aspx page and then dwindling down in the later chapters to just a "and do this" verbage like most of the directions that are well practiced by then.

James
 
Old July 16th, 2012, 03:30 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi James,

Looks like you missed step 5 on page 499:

Quote:
Create a new Web Form based on your custom template in the root of the site and call it NewPhotoAlbum.aspx. Give the page a title of Create New Photo Album.
Note the "custom template"; this gives the page the behavior to switch between the themes. This instruction is, as far as I know, repeated in all TIOs where it matters.

The Find and Replace exercise was an optional one and was only used to upgrade the pages you had already created at that point.

Hope this helps,

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
Chapter 9 - Sending E-mail Messages demac3 BOOK: Beginning ASP.NET 4 : in C# and VB 4 November 4th, 2010 03:39 PM
Chapter 9:page 310,sending email messages Arya BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 4 January 4th, 2010 09:51 PM
chapter 9:Creating Email messages pg310 the3musketeer BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 January 21st, 2009 03:29 AM
sending email keyvanjan Classic ASP Components 1 May 9th, 2005 05:56 PM





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