Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
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 26th, 2010, 08:41 PM
Authorized User
 
Join Date: Jun 2010
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Final Website Contact.aspx failing with error

When sending the completed contact form an error messge occures.

This does not happend with the new user sign up form.

Why does the new user form work and the contact form fail.

Please advise, Larry

Chapter 19 contact form works fine.

Here is web.config from chapter 19 and final website which I modifed.

My code.

code

<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="[email protected]">
<network host="mail.optonline.net" password="xxxxx" userName="xxxxxx" />
</smtp>
</mailSettings>
/code

From chapter 19

code


<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory" from="Planet Wrox &lt;[email protected]&gt;">
<specifiedPickupDirectory pickupDirectoryLocation="C:\TempMail"/>
</smtp>
</mailSettings>
</system.net>

/code
 
Old July 27th, 2010, 02:51 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 Larry,

Again, please be more specific. What error do you get exactly? Did you try to debug the code as explained in Chapter 18? Have you tried looking at its Message property? All this information helps me help you, resulting in quicker and more accurate answers.

I can't see anything wrong in the code you posted. Since I don't know what failed (the config code or the actual code in the forms?) I can only guess that C:\TempMail does not exist. As explained in the book, you need to create this folder yourself as it's not created for you automatically.

Hope this helps.

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 27th, 2010, 08:59 PM
Authorized User
 
Join Date: Jun 2010
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Final Website Contact.aspx failing with error

I put breakpoints in the ContactForm.ascx.

I filled every field in the contact form. ie. Contact.aspx

I clicked send and debugged the ContactForm.ascx.

I hope this helps. It's a little above my head.

What is confusing is the SignUp.aspx form works fine and sends email response.

Their both forms send email responses.

Please advise.

Read Below for more detail.

Larry

It fails at :

code

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

MessageSentPara.Visible = True
FormTable.Visible = False
System.Threading.Thread.Sleep(5000)
Catch
Message.Text = "An error occurred while sending your e-mail. Please try again."

/code

The exception snapshot says : {"The specified string is not in the form required for an e-mail address."}


When you debug internet explorer the error msg says: Sys.WebForms.PageRequestManagerTimeoutException: The server request timed out.


web.config email code is:

code

<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="[email protected]">
<network host="mail.optonline.net" password="wa2jsb" userName="lstew452"/>
</smtp>
</mailSettings>
</system.net>

/code
 
Old July 28th, 2010, 02:49 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,

Quote:
The specified string is not in the form required for an e-mail address
This implies that either the From or the To address is not valid. Since you didn't supply that code, it's hard to tell which one it is.

Make sure you assign valid e-mail addresses; if they come from the web.config file, make sure those are valid as well. If you still can't make it work, please post the code for the User Control, the appSettings element and the web.config code.

BTW: if those are real details in the web.config you posted, you may want to edit your post.

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 28th, 2010, 09:44 PM
Authorized User
 
Join Date: Jun 2010
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Final Website Contact.aspx failing with error

Hi Imar,

I de-bugged the problem. It was in webconfig file at. See code below.

I did a global replace changing all your info to mine. So this is what happened.

Opps.

<add key="FromAddress" value="webmaster@http://mywebsite.net/"/>

that will never work.

So changed the code at that point to my email at [email protected] That's works.


Have to watch those gloabal replaces.

Thanks for all your help.

Larry

wrong

code

<appSettings>
<add key="FromAddress" value="webmaster@http://mywebsite.net/"/>
<add key="FromName" value="mywebsite"/>
<add key="ToAddress" value="webmaster@http://mywebsite.net/"/>
<add key="ToName" value="mywebsite"/>
<add key="SendMailOnError" value="false"/>
/code

Good code.

code

<appSettings>
<add key="FromAddress" value="[email protected]"/>
<add key="FromName" value="SCS Technology Consultants"/>
<add key="ToAddress" value="[email protected]"/>
<add key="ToName" value="SCS Technology Consultants "/>
<add key="SendMailOnError" value="false"/>
</appSettings>/code





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error With Contact Form ASP.NET 3.5 CSharpCoder BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 July 28th, 2008 04:08 PM
Question about Contact.aspx page lc3035 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 April 23rd, 2008 11:24 AM
website error kucker6 ASP.NET 1.0 and 1.1 Basics 3 June 1st, 2006 01:08 PM
System.Exception .aspx website dephjam C# 3 April 13th, 2005 07:59 PM





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