Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 22nd, 2008, 04:53 PM
Registered User
 
Join Date: Jul 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error With Contact Form ASP.NET 3.5

Hi
If anyone tries to use the contact form and recieves an error, try this.
protected void cmdSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            MailMessage msg = new MailMessage();
            msg.IsBodyHtml = false;
            msg.From = new MailAddress(txtEmail.Text, txtYourName.Text);
            msg.To.Add(new MailAddress(Globals.settings.ContactForm.MailTo));
            if (!string.IsNullOrEmpty(Globals.settings.ContactFor m.MailCC)) ;
            msg.Subject = string.Format(Globals.settings.ContactForm.MailSub ject, ddlSubject.SelectedValue.ToString());
            msg.Body = txtMessage.Text;
            new SmtpClient().Send(msg);
            lblFeedbackOK.Visible = true;
            lblFeedbackKO.Visible = false;
        }
        catch(TypeInitializationException ex)
        {
            try
            {

                throw ex.InnerException;
            }
            finally
            {
                //return;
            }
        }
           }

Notice the:
 catch(TypeInitializationException ex)
        {
            try
            {

                throw ex.InnerException;
            }

If you get the following error:
Parser Error Message: An error occurred creating the configuration section handler for *******: Could not load file or assembly '_code' or one of its dependencies. The system cannot find the file specified.

Remove _code from the web config file:

<section name="theBeerHouse" type="MB.TheBeerHouse.TheBeerHouseSection"/>

And it should work OK, not sure why as if i run the beerhouse in ASP.NET 2.0 it works ok, but not in ASP.NET 3.5

George



 
Old July 28th, 2008, 04:08 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

The reason your code failed is that you're supposed to have TWO underscores in front:

__code

NOT

_code

DON'T remove this part as suggested. It will screw up your custom configuration.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Contact Form and Gmail Jamessaep BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 April 16th, 2008 07:58 AM
Contact form XML attachments. retroviz BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 March 16th, 2008 09:52 AM
Converting an HTML Form to ASP.Net Form k_alidxb75 ASP.NET 1.x and 2.0 Application Design 0 November 30th, 2006 03:26 AM
Contact Form myself Classic ASP Basics 1 November 18th, 2006 11:16 AM
PHP contact form probe4 PHP How-To 1 September 14th, 2005 12:52 PM





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