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 September 2nd, 2009, 09:33 PM
Registered User
 
Join Date: Aug 2009
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default Type Initialization Exception on Globals

Hi fellows, I've got the following innerException at my Globals setting. It seems that the code is not able to get the custom configuration in the site's config-file. Is there anybody out there who could help me with this problem?
Thanks in advance!
Here is the inneException:
Code:
TYPE:
System.Configuration.ConfigurationErrorsException
MESSAGE:
An error occurred creating the configuration section handler for TheCwcSiteSection: Could not load file or assembly '__code' or one of its dependencies. The system cannot find the file specified. (C:\Users\Ägaren\Documents\Visual Studio 2008\Projects\WebApplication1\WebApplication1\web.config line 4)
STACK TRACE:
   at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
   at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
   at System.Web.HttpContext.GetSection(String sectionName)
   at System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName)
   at System.Web.Configuration.WebConfigurationManager.GetSection(String sectionName)
   at cwc.website.Globals..cctor() in C:\Users\Ägaren\Documents\Visual Studio 2008\Projects\WebApplication1\WebApplication1\Code\Globals.cs:line 18
 
Old September 2nd, 2009, 10:51 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

If you are targeting .NET 3.5, do not include the __code part when you register the custom section in web.config.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
The Following User Says Thank You to Lee Dumond For This Useful Post:
mzsohi (September 3rd, 2009)
 
Old September 3rd, 2009, 05:10 AM
Registered User
 
Join Date: Aug 2009
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default Thank you!

Great! It works directly.
Thank you for your quick respons!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Chapter 3 Type Initialization error canyiah BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 7 April 9th, 2009 06:07 PM
An unhandled exception of type 'System.Data.OleDb. Harvey_swift VB Databases Basics 1 May 30th, 2006 12:57 PM
Type mimatch & Exception Occured Error Sameer Kulkarni Classic ASP Professional 4 March 9th, 2006 05:41 AM
type load exception crazy_eye_bob Crystal Reports 4 November 7th, 2005 01:16 PM
unhandled exception of type 'System.Net.WebExcepti booksnore2 C# 0 June 26th, 2004 07:26 AM





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