Subject: Problem with Chapter 3 Type Initialization error
Posted By: canyiah Post Date: 4/16/2008 7:38:44 AM
Im having a problem with the vb version i am getting an error in the basePage class
at the dim id as string = globals.themeselectorID
'Type initializer for 'MB.TheBeerHouse.Globals' threw an exception. i cant figure out how to solve this problem

if i do a debug and enter globals.themesselector into watch it says that its not a member of globals. but in the code intellisense picks up all properties

Reply By: canyiah Reply Date: 4/16/2008 10:48:23 AM
i solved the problem my web.config file was incorrect.

Reply By: mwillard65 Reply Date: 4/22/2008 1:56:31 PM
What did you do, I'm get the same error in the c# version.

Reply By: canyiah Reply Date: 4/24/2008 8:42:20 AM
I just copied the web.config file from the completed sample chapter and made sure all my page inherits were correct

Reply By: patrickst1 Reply Date: 5/21/2008 9:06:19 AM
I am also recieving this error and cannot figure it out.  I have taken the site back down to a working version (chapter 2) and found that it was the following C# code that is causing the issue.  I have checked the web.config file and it is the same as the chapter by chapter (which I would like to add, does not work on my machine either).  All of the references are the same.  

public readonly static TheBeerHouseSection Settings =
          (TheBeerHouseSection)WebConfigurationManager.GetSection("theBeerHouse");


It is like the Globals class is not being initialized and I am not sure why.  Any help would be greatly appreciated.

Thanks,
Patrick

Reply By: patrickst1 Reply Date: 5/21/2008 10:42:13 AM
I actually found a work around, not sure why I was having trouble but this seemed to fix the issue.


public static TheBeerHouseSection Settings
{
    get
    {
        return (TheBeerHouseSection)WebConfigurationManager.GetSection("theBeerHouse");
    }
}



Go to topic 71440

Return to index page 1