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 August 27th, 2010, 09:50 AM
Authorized User
 
Join Date: Jul 2010
Posts: 81
Thanks: 10
Thanked 3 Times in 2 Posts
Default Ch 9 Form Submission Server Error

Well I thought I had this all working, yesterday. I left VWD running overnight and I ran Contact.aspx in the browser (p 313). I have messagebox pop up. So I submit data after filling all the fields. I get a server error. The server error tells me to set debug="true" in web.config which I do.

First error:

Could not find a part of the path 'C:\BegASPNETCS\Site\App_Data\ContactForm.txt'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\BegASPNETCS\Site\App_Data\ContactForm.txt'.

Source Error:

Code:
Line 31:     {
Line 32:       string fileName = Server.MapPath("~/App_Data/ContactForm.txt");
Line 33:       string mailBody = File.ReadAllText(fileName);
Line 34: 
Line 35:       mailBody = mailBody.Replace("##Name##", Name.Text);

I see that your source files have this directory and my program doesn't. So I copy it over, and this error is gone. Then:

I get this error when I resubmit the filled form.

The SMTP host was not specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The SMTP host was not specified.

Source Error:

Code:
Line 47: 
Line 48:       SmtpClient mySmtpClient = new SmtpClient();
Line 49:       mySmtpClient.Send(myMessage);
Line 50: 
Line 51:       Message.Visible = true;
Not sure what happened here!
__________________
Bob
bdtcomp.com
http://lettersfromasoldier.com
Follow me on Twitter
“Success is not final, failure is not fatal: it is the courage to continue that counts.”~Winston Churchill
 
Old August 27th, 2010, 10:06 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
Not sure what happened here!
Exactly what the error message says:
Quote:
The SMTP host was not specified.
Take a look at page 317 and further to see how to specify one.

I think the fact you're getting these errors (missing template file etc) seems to indicate you skipped a few steps.

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 August 27th, 2010, 10:11 AM
Authorized User
 
Join Date: Jul 2010
Posts: 81
Thanks: 10
Thanked 3 Times in 2 Posts
Default

Thanks Imar for quick response, and I got to thinking after I sent this, that maybe there was additional code. Since I copied your user control after mine became corrupt the other day, I also copied some code you had in the:

protected void SendButton_Click(object sender, EventArgs e)

So I removed the code there for now, since I didn't intentionally want or put it there, getting ahead of myself (and not knowing it). Then it worked. Thanks again.
__________________
Bob
bdtcomp.com
http://lettersfromasoldier.com
Follow me on Twitter
“Success is not final, failure is not fatal: it is the courage to continue that counts.”~Winston Churchill





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error ch 19, opening form, adp-file vitmoss2 BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 0 October 4th, 2008 05:09 AM
form submission...help!? mdbrueckner ASP.NET 2.0 Basics 1 September 19th, 2007 06:16 PM
Simple Form Submission Maxood Beginning PHP 3 July 17th, 2004 06:03 AM
conditional form submission moushumi Classic ASP Basics 1 March 30th, 2004 08:12 AM





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