Cannot read application settings

V

vvenk

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
 
S

Slim

vvenk said:
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?


posting to a asp group with a asp.net problem
 
D

Dave Anderson

vvenk said:
rootWebConfig1.AppSettings.Settings.Count always returns 0.

What am I doing wrong?

For one, you are asking in a classic ASP forum. You might have better luck
in [microsoft.public.dotnet.framework.aspnet].
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top