Cannot get Application Setting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello:

I've defined two application settings in my web.config file. But in the
following code :

Dim rootWebConfig1 As System.Configuration.Configuration
rootWebConfig1 =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Nothing)
If (rootWebConfig1.AppSettings.Settings.Count > 0) Then

sField1 = rootWebConfig1.AppSettings.Settings("field1")
sField2 = rootWebConfig1.AppSettings.Settings("field2")

End If

rootWebConfig1.AppSettings.Settings.Count always returns 0.

What am I doing wrong?

Venki
 
What am I doing wrong?

The code Microsoft provides doesn't work. I had the exact same problem
you did.

You can use AppSettings.Item("YourKeyHere") to get the value.
 
Back
Top