View Single Post
  #2 (permalink)  
Old September 18th, 2006, 06:53 AM
dparsons dparsons is offline
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Is your web.config in the root directory of your application?

Have you tried just writing the value to the screen as opposed to actually trying to use it? (e.g. Response.Write(ConfigurationSettings.AppSettings("[keyname]"))

I store all of my database connection strings in the web.config file and do something like this:

web.config:
<appSettings>
<add key="Clients" value="workstation id=PC;user ID=Username;password=Password;data source=Server;persist security info=True;initial catalog=Database"/>
</appSettings>

In code:

sqlConn = New SqlConnection
sqlConn.ConnectionString = ConfigurationSettings.AppSettings("Clients")

And this works fine.

--Stole this from a moderator

I will only tell you how to do it, not do it for you.

Unless, of course, you want to hire me to do work for you.