Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 Search this Thread Display Modes
  #1 (permalink)  
Old August 27th, 2010, 09:50 AM
Authorized User
Points: 350, Level: 6
Points: 350, Level: 6 Points: 350, Level: 6 Points: 350, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2010
Location: Eastern Michigan-Near Canada
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
Reply With Quote
  #2 (permalink)  
Old August 27th, 2010, 10:06 AM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #3 (permalink)  
Old August 27th, 2010, 10:11 AM
Authorized User
Points: 350, Level: 6
Points: 350, Level: 6 Points: 350, Level: 6 Points: 350, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2010
Location: Eastern Michigan-Near Canada
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
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



All times are GMT -4. The time now is 01:53 PM.


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