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 November 4th, 2010, 02:44 PM
Authorized User
 
Join Date: Feb 2010
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
Default Chapter 9 - Sending E-mail Messages

I have a couple questions about step 3 in the Try it Out on page 319.

1. I was unable to click anywhere on the Design View to generate the Page_Load handler. Also, the drop down lists at the top of the Document Window for Demos/Email.aspx.vb had nothing in them. I ended up copying the code from the Source directory and pasting it here. What was I doing wrong?

2. The Partial Class line in my code below did not replace $relurlnamespace_Email with Demos-Email similar to this file in the Source directory. Do have a disconnect here?



Code:
Imports System.Net.Mail

Partial Class $relurlnamespace_Email
    Inherits BasePage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim myMessage As MailMessage = New MailMessage()
        myMessage.Subject = "Test Message"
        myMessage.Body = "Hello world, from Planet Wrox"
        myMessage.From = New MailAddress("you@yourprovider.com", "Sender Name")
        myMessage.To.Add(New MailAddress("you@yourprovider.com", "Receiver Name"))

        Dim mySmtpClient As SmtpClient = New SmtpClient()
        mySmtpClient.Send(myMessage)
    End Sub

End Class
 
Old November 4th, 2010, 02:50 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 there,

Looks like your template is not OK. Did you wrap the rerurlnamespace in dollar signs on both ends when you created the template?

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!
The Following User Says Thank You to Imar For This Useful Post:
demac3 (November 4th, 2010)
 
Old November 4th, 2010, 03:20 PM
Authorized User
 
Join Date: Feb 2010
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
Default

Imar,

I'm not sure what I did wrong. Your answer helped me understand that the problem was likely in the template. I recreated it (taking more care with my typing) and the problem went away. I suspect you were right about missing the dollar signs. Thanks, again.

How about my other question?
 
Old November 4th, 2010, 03:25 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I think it's caused by the same issue (hence I didn't respond to it). The Code Behind is invalid and thus VWD can't make heads or tails of it, and doesn't know where to add the code or what to show in the drop downs.

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!
The Following User Says Thank You to Imar For This Useful Post:
demac3 (November 4th, 2010)
 
Old November 4th, 2010, 03:39 PM
Authorized User
 
Join Date: Feb 2010
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
Default

Yes, indeed. I gues I should have checked it again after fixing the other problem. Thanks, again!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9. I can't figure how to configure my website for sending E-mail banditonehundred BOOK: Beginning ASP.NET 4 : in C# and VB 11 April 19th, 2010 07:21 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
Creating E-Mail Messages shoe1189 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 February 17th, 2009 11:07 AM
Question Re Sending mail in Chapter 3 _fluffy_ BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 January 9th, 2007 12:30 AM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM





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