Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2006, 11:50 AM
Authorized User
 
Join Date: Oct 2006
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default eroor in web.config

i m new to asp.net 2.0
i m working on web application.i m doing connection in web.config file.it gives following error
Error 4 Unrecognized configuration section add.F:\WebSite3 Web.config
i have written following code. what is wrong?
<appSettings/>
  <add key="ConnString" value="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ensurecms;Data Source=VENUS;"/>

plz give a solution
thx n regards
abaso jadhav

 
Old October 27th, 2006, 12:00 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there..

first of all, the web config file is an xml file.. so you have your appsettings close, the file should be something like
Code:
  <appSettings>
    <add key="ConnString" value="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ensurecms;Data Source=VENUS;"/>
  </appSettings>
anyway, since you are declaring a connection string, you should now that in 2.0 there is a conection string section in the web.config.

you can do something like this
Code:
  <connectionStrings>
        <add name="ConnString" connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ensurecms;Data Source=VENUS;"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
you should check the providername ;)

then is will be easier to connect datasources (since it will recognize the connectionstrings section) and by code using:

Code:
System.Configuration.ConfigurationManager.ConnectionStrings("ConnString").ConnectionString
HTH

Gonzalo
 
Old October 28th, 2006, 01:22 AM
Authorized User
 
Join Date: Oct 2006
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanku
it is working now





Similar Threads
Thread Thread Starter Forum Replies Last Post
web.config vs. app.config darlo Visual Studio 2005 11 August 20th, 2008 07:23 AM
web.config sonny1 ASP.NET 2.0 Basics 1 October 20th, 2007 01:40 PM
I need Help with web.config please ! _fluffy_ BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 January 4th, 2007 05:31 PM
Web.Config tranzformerz ASP.NET 1.0 and 1.1 Basics 1 August 29th, 2005 05:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.