Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

appsettings problem

Status
Not open for further replies.

barrylowe

Programmer
Nov 6, 2001
188
GB
I am trying to implement an appsettings value in my web.config file to store my connectionstring value.

Everything works fine until I put the following code in my web.config file:

<appsettings>
<add key="strConnectionString" value="packet size=4096;integrated security=SSPI;persist security info=False;initial catalog=jobshop" />
</appsettings>


as soon as this code is added I get the follwing error message when I try to tun the page:

Error while trying to run project: Unable to start debugging on the server. Server side-error occurred on sending debug HTTP request.

Make sure the server is operating correctly. Verify there are no syntax errors in the web.config by doing a Debug.Start Without Debugging. You may also want to refer to the ASP.NET and ATL Server debugging topic in the online documentation.


I am putting this code in directly after the <configuration> tag and before <system.web>

I thought perhaps there was a problem with the value of the appsetting but the same error occurs even if I only put in:

<appsettings></appsettings>

Can anyone help?
 
Could you paste the full web.config file you are using so we can try it in a test project (including the appSettings section that you say isn't working)?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
What version of the framework are you using. If it's 2.0 then there is a new section that you might want to try.

Code:
<configuration>
	<appSettings/>
	<connectionStrings>
		
		<add name="ConnString" connectionString="Data Source=test;Initial Catalog=db_test;user id=test_user;password=te5t"/>
		
	</connectionStrings>
	<system.web>

And you can access it like this...

Code:
Dim connectString As String = _
System.Web.Configuration.WebConfigurationManager.ConnectionStrings("ConnString").ToString

Keep in mind that is just one way of using this.
 
Thanks for you help folks but I figured it out myself.

There seems to have been a conflict with some <Location> tags I was using in the web.config file.

I moved my <appsettings> tags after the <Location> tags but still within the <configuration> tag, and it worked fine. Seemed to be a positional problem.

For info I am using v.1.1 of the framework.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top