Thank you for your response.
I took a look at the first link you have (didn't get to all of them), and
seemed like the suggestion is exactly what I want. But when I tried it I
get "Exception creating section handler". Here is my code:
<configuration>
<configSections>
<section name="PatientSurveySettings"
type="System.Configuration.NameValueFileSectionHan dler,
System, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
</configSections>
<MyAppSettings>
<add key="connString" value="connection string" />
</MyAppSettings>
...
</configuration>
It crashes on line #3. Am I not supposed to use the exact numbers or
something?
Scott
"Scott Mitchell [MVP]" <> wrote in message
news:c1r%b.2875$ m...
> > I have some program constants that I need to set and I thought it would
> be
> > best to set them all up in a central location so that I can change them
> > quickly when we go from development to production. What is the best way
> to
> > do that? Should I put them in web.config? Should I create a special
> class
> > for these settings? Wherever it is best to write them, can you give me
> a
> > line or 2 of code to show the best way to set a constant string?
>
> You could put them in the Web.config's <appSettings> block, that's one
> option (more information at
> http://aspnet.4guysfromrolla.com/art...053102-1.aspx). The
> disadvantage with this is if you have multiple Web applications that need
> to share constants you have to replicate the <appSettings> section in
> numerous projects.
>
> Another option (that is useful for sharing constants across multiple Web
> projects) is to use a custom XML file and a custom class to read/cache the
> constants. There's an article that looks at this here:
>
> Using XML to Share Constants Across Projects
> http://aspnet.4guysfromrolla.com/articles/121003-1.aspx
>
> A good background article - that looks at sharing constants and common
> functions - is available at:
>
> Accessing Common Code, Constants, and Functions in an ASP.NET Project
> http://aspnet.4guysfromrolla.com/articles/122403-1.aspx
>
> Happy Programming!
>
> --
>
> Scott Mitchell
>
> http://www.4GuysFromRolla.com
> http://www.ASPFAQs.com
> http://www.ASPMessageboard.com
>
> * When you think ASP, think 4GuysFromRolla.com!
>
>
>
>