DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: App.config not Working

  1. #1
    Join Date
    Oct 2005
    Posts
    1

    App.config not Working

    Hi,
    I have added new App.config file in my project and written this code,

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <appSettings>
    <add key="ConnectionString" value="data source=myserver;initial catalog=Apps;Integrated Security=SSPI;packet size=4096" />
    </appSettings>
    </configuration>

    I am trying to set "ConnectionString" as global variable. When i run this project it does not somehow create the
    .exe file for this app.config file. So "null" value is passed in ConnectionString in all templates.
    Any Help will be appreciated.........

    Regards,

  2. #2
    Join Date
    Sep 2004
    Posts
    52
    If it's a web app, make sure the config file is called web.config and resides in the root directory of your web site.

    If it's a windows forms app, make sure the config file is called YourExe.exe.config and resides in the same directory as your exe.

    Then use System.Configuration.ConfigurationSettings.AppSettings["whatever"]

    HTH,
    Kent

  3. #3
    Join Date
    Dec 2003
    Posts
    2,750
    I'm not sure if I understand your question, but the App.config file is not compiled into the assembly. You have to include it as a separate distributable as Kent indicated.
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

Similar Threads

  1. Replies: 1
    Last Post: 12-05-2001, 07:12 AM
  2. changing working dir in Java
    By Jim in forum Java
    Replies: 1
    Last Post: 02-18-2001, 02:58 PM
  3. focus() & select() not working
    By Craig in forum Web
    Replies: 7
    Last Post: 02-08-2001, 03:16 PM
  4. VSS:sharing same working folder without multiple checkouts
    By rahul phatak rahulphatak in forum ASP.NET
    Replies: 0
    Last Post: 06-01-2000, 05:41 PM
  5. Sysinfo not working GetSystemPowerStatus not working
    By Thomas Hauff in forum VB Classic
    Replies: 0
    Last Post: 04-08-2000, 10:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center