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 February 2nd, 2007, 05:55 AM
Registered User
 
Join Date: Jan 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default in web.config or ConfigSection.cs?

in the book, we have some settings stored in the <theBeerHouse> of web.config and some in the TheBeerHouseSection class of ConfigSection.cs and some both(defaultConnectionStringName). is there a logic or rule to determine what goes to what? i can't just copy from the book without knowing why. if you figure this out, can you help me here? thanks!!

 
Old February 3rd, 2007, 03:59 AM
Registered User
 
Join Date: Jan 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

or if anyone can point me to from where i can get help on this issue? that'd be much appreciated.

 
Old February 3rd, 2007, 04:39 AM
Authorized User
 
Join Date: May 2006
Posts: 99
Thanks: 0
Thanked 1 Time in 1 Post
Default

We created our own application settings and placed them in TheBeerHouse section of web.config. The ConfigSection.cs provides us with a configuration tier to get at the application settings. There is really nothing mysterious about it. Each configuration level within web.config has a corresponding class in ConfigSection.cs that defines what is to be found and any default values. The top-level item is TheBeerHouse section which is defined when we inherit from ConfigurationSection. Notice that there are two properties that are not defined as elements (defaultConnectionStringName and defaultCacheDuration). Those properties have default values assigned so that if they are not defined in web.config those values are used. As it happens, defaultConnectionStringName is defined and defaultCacheDuration is not. We could override the defaultCacheDuration in this way:
<TheBeerHouse defaultConnectionStringName="LocalSqlServer" defaultCacheDuration=250 >

Each of the elements is defined as required, meaning that they are expected within TheBeerHouse configuration and each class which defines the element is inherited from ConfigurationElement. An element can also have properties and, in fact, they all do. Remember that each of the other tiered providers, etc. will use these configuration elements.

I hope that I have shed a little light on the subject.






Similar Threads
Thread Thread Starter Forum Replies Last Post
web.config dpkbahuguna ASP.NET 3.5 Basics 2 August 26th, 2008 09:41 AM
web.config vs. app.config darlo Visual Studio 2005 11 August 20th, 2008 07:23 AM
Web Config SteveP55419 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 January 3rd, 2007 04:19 PM
web.config nagsumam .NET Framework 1.x 3 November 29th, 2006 10:09 AM
configSection.cs and other bafflements MM BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 November 16th, 2006 06:45 PM





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