Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 22nd, 2008, 04:53 PM
Registered User
 
Join Date: Jul 2008
Location: , , .
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



  #2 (permalink)  
Old July 28th, 2008, 04:08 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
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.

 


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



All times are GMT -4. The time now is 07:40 AM.


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