473,397 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

application cannot read the app.config file

application cannot read the app.config file

i have a config file for the executable

i try to read it but it throws an exception

when building the setup for the project vs2005 do not add the
app.config automatically

public Form1()
{
InitializeComponent();

try
{
System.Configuration.AppSettingsReader
configurationAppSettings = new
System.Configuration.AppSettingsReader();

username =
configurationAppSettings.GetValue("username",
typeof(string)).ToString();
domain = configurationAppSettings.GetValue("domain",
typeof(string)).ToString();
senha = configurationAppSettings.GetValue("senha",
typeof(string)).ToString();
Comum.Utils.Impersonate.login(username, domain,
senha);
}
catch (Exception e) { MessageBox.Show(e.Message); }
}
Jul 15 '08 #1
4 4048
On Jul 15, 3:50 am, pedro <pe...@code4cerveja.comwrote:
application cannot read the app.config file

i have a config file for the executable

i try to read it but it throws an exception
What is the exception? Is you config file named exename.exe.config
as it should be? Any additional information would be helpful.

Chris
Jul 15 '08 #2
I must agree with Mr. Dunaway. We need more info to help.

What line is causing the Exception?

What does the Exception Message say?

What information is contained in your app.config file?

"Pedro for President"

"pedro" wrote:
application cannot read the app.config file

i have a config file for the executable

i try to read it but it throws an exception

when building the setup for the project vs2005 do not add the
app.config automatically

public Form1()
{
InitializeComponent();

try
{
System.Configuration.AppSettingsReader
configurationAppSettings = new
System.Configuration.AppSettingsReader();

username =
configurationAppSettings.GetValue("username",
typeof(string)).ToString();
domain = configurationAppSettings.GetValue("domain",
typeof(string)).ToString();
senha = configurationAppSettings.GetValue("senha",
typeof(string)).ToString();
Comum.Utils.Impersonate.login(username, domain,
senha);
}
catch (Exception e) { MessageBox.Show(e.Message); }
}
Jul 15 '08 #3
On Jul 15, 4:50*am, pedro <pe...@code4cerveja.comwrote:
application cannot read the app.config file

i have a config file for the executable

i try to read it but it throws an exception

when building the setup for the project vs2005 do not add the
app.config automatically
If you added the app.config by using the menu option it will be marked
as content.
If you ceated the file manually you need to set it to "Content"a dn
also "Copy always"

Also in the setup make sure that you select the "project output" as
the source of the setup.
Jul 15 '08 #4
On Jul 15, 1:50*pm, pedro <pe...@code4cerveja.comwrote:
application cannot read the app.config file

i have a config file for the executable

i try to read it but it throws an exception

when building the setup for the project vs2005 do not add the
app.config automatically

* * * * public Form1()
* * * * {
* * * * * * InitializeComponent();

* * * * * * try
* * * * * * {
* * * * * * * * System.Configuration.AppSettingsReader
configurationAppSettings = new
System.Configuration.AppSettingsReader();

* * * * * * * * username =
configurationAppSettings.GetValue("username",
typeof(string)).ToString();
* * * * * * * * domain = configurationAppSettings.GetValue("domain",
typeof(string)).ToString();
* * * * * * * * senha = configurationAppSettings.GetValue("senha",
typeof(string)).ToString();
* * * * * * * * Comum.Utils.Impersonate.login(username, domain,
senha);
* * * * * * }
* * * * * * catch (Exception e) { MessageBox.Show(e.Message);}
* * * * }

What does the exception.Message say?

-Cnu
Jul 16 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Pramod Thewarkar | last post by:
Hi, I have deployed my winform application on iis server in a virtual directory. On the start of my application, it is reading some information from the config file (app.config). When i am...
3
by: Mustaq | last post by:
Hi, How to read same config file from different application? I have 4 application in VB.NET, all are using different app.config files. NOW I need all to read only one config file, how can I do...
6
by: Sean | last post by:
Hi, I am developing a windows .NET apps to be used in several countries with different languages and I want to use a configuration file to retrieve the fields in the right language depend on the...
2
by: Wayne | last post by:
I have an application where I added a comment as the first line of my Config file, as I found out I can't do this. However, an entry was made in the event log about the error (Source = .net...
5
by: Sridhar | last post by:
Hi, I have created a project which contains classes to read the data from the database. This project has an App.Config file which contains the SqlConnection String. when this code is called from...
7
by: Steven Cliff | last post by:
I have started to use the new Enterprise Library (Jan 06) and have set up a skeleton project using the DAAB. This all seems to work fine apart from when I come to secure the app.config file via...
4
by: Mukesh | last post by:
Hi I m using microsoft application blocks Enterprise Library june 2005 with .net framework 1.1 and VStudio2003 And C# as coding language Sql server 2000 database the project is running...
3
by: Mukesh | last post by:
Thx Sloan for the solution. It is working properly under Full trust When i tried it under Medium trust it was giving error Parser Error Message: Required permissions cannot be acquired....
0
by: Tifer | last post by:
Hello, I am building my first .Net Application. The first couple of Publish and Installs I did went fine. But after a couple of builds, I get a modal dialogue box error every time upon trying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.