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!