472,993 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 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 4023
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.