473,786 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't read the appSettings section of web.config (Windows Server 2003)

I've searched the web for a solution to this problem. Surprisingly, no
problem/solution has been posted yet.

We can read application configuration information fine when our
asp.net application runs on a Windows 2000 server. But when we run
this same application from Windows 2003, we can't read any application
configuration.

The code in question is this (in default.aspx):

private void Page_Load(objec t sender, EventArgs e)
{
NameValueCollec tion sAll = ConfigurationSe ttings.AppSetti ngs;

foreach (string s in sAll.AllKeys)
{
Response.Write ("Key: " + s + " Value: " + sAll[s] + "<br>");
}

Response.End ();
}

In web.config, we have this:
<appSettings>
<add key="key" value="value"/>
</appSettings>

This code correctly writes the following to the browser on Windows
2000:
Key: key Value: value

On Windows Server 2003 nothing is written.

We configured w3wp.exe (asp.net worker process on Windows 2003) to run
with administrator access, but this didn't fix things. We changed the
ACL of web.config to grant various different AD ids read/write
privileges, but this also didn't solve the problem.

Anybody have any suggestions?

Thanks,
Jared
Nov 19 '05 #1
2 5021
1. change the aspnet_wp BACK to aspnet userid immediately!

2. look in the machine.config file, verify that the appsettings sectiongroup
is defined.

also try removing / reinstalling asp.net on the 2003 server...
--
Eric Newton
eric.at.ensoft-software.com
www.ensoft-software.com
C#/ASP.net Solutions developer

"Jared Hagel" <ja*********@cp r.ca> wrote in message
news:a7******** *************** ***@posting.goo gle.com...
I've searched the web for a solution to this problem. Surprisingly, no
problem/solution has been posted yet.

We can read application configuration information fine when our
asp.net application runs on a Windows 2000 server. But when we run
this same application from Windows 2003, we can't read any application
configuration.

The code in question is this (in default.aspx):

private void Page_Load(objec t sender, EventArgs e)
{
NameValueCollec tion sAll = ConfigurationSe ttings.AppSetti ngs;

foreach (string s in sAll.AllKeys)
{
Response.Write ("Key: " + s + " Value: " + sAll[s] + "<br>");
}

Response.End ();
}

In web.config, we have this:
<appSettings>
<add key="key" value="value"/>
</appSettings>

This code correctly writes the following to the browser on Windows
2000:
Key: key Value: value

On Windows Server 2003 nothing is written.

We configured w3wp.exe (asp.net worker process on Windows 2003) to run
with administrator access, but this didn't fix things. We changed the
ACL of web.config to grant various different AD ids read/write
privileges, but this also didn't solve the problem.

Anybody have any suggestions?

Thanks,
Jared

Nov 19 '05 #2
This problem occurs for me in the simplest scenario.

I wrote a web application with the following code in default.aspx:

private void Page_Load(objec t sender, System.EventArg s e)
{
Label1.Text = ConfigurationSe ttings.AppSetti ngs["LabelText"];
}

web.config contains:

<appSettings>
<add key="LabelText" value="test passed"/>
</appSettings>

This label isn't being displayed with the value "test passed" in
Windows Server 2003! Only on Windows 2000.

I'm stumped. Does anybody have any suggestions?

Thanks,
Jared

ja*********@cpr .ca (Jared Hagel) wrote in message news:<a7******* *************** ****@posting.go ogle.com>...
I've searched the web for a solution to this problem. Surprisingly, no
problem/solution has been posted yet.

We can read application configuration information fine when our
asp.net application runs on a Windows 2000 server. But when we run
this same application from Windows 2003, we can't read any application
configuration.

The code in question is this (in default.aspx):

private void Page_Load(objec t sender, EventArgs e)
{
NameValueCollec tion sAll = ConfigurationSe ttings.AppSetti ngs;

foreach (string s in sAll.AllKeys)
{
Response.Write ("Key: " + s + " Value: " + sAll[s] + "<br>");
}

Response.End ();
}

In web.config, we have this:
<appSettings>
<add key="key" value="value"/>
</appSettings>

This code correctly writes the following to the browser on Windows
2000:
Key: key Value: value

On Windows Server 2003 nothing is written.

We configured w3wp.exe (asp.net worker process on Windows 2003) to run
with administrator access, but this didn't fix things. We changed the
ACL of web.config to grant various different AD ids read/write
privileges, but this also didn't solve the problem.

Anybody have any suggestions?

Thanks,
Jared

Nov 19 '05 #3

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

Similar topics

2
3316
by: MrFile | last post by:
I added an app.config file to my application. (c#.net component dll) <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="username" value="xx" /> <add key="password" value="xx" /> </appSettings> </configuration>
5
2296
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 a web application and if I need to read the connection string it is reading the connection string from the web.config of web application. I am not knowing how to change the Application domain so that it reads the App.config file instead of...
6
4903
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
4
22542
by: PeterW | last post by:
I have a Windows service that needs to get some values from a config file. I place the config file for the service in the System32 directory. I do not get the values using the usual ConfigurationSettings.AppSettings Any tips please cheers -- PeterW
2
8178
by: mahesh.anjani | last post by:
hi i have stored my connction string in web.config as we do usually. code of web.confing is given below. check the password field contain "&" character. now when i run my application it gives error because value of ConnectionString is breaked at "&". So how to store value in web.config that contain "&" character, if any
10
3675
by: Brett Romero | last post by:
I'd like to store something such as the following the my app.config file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="DEBUG" value="true"/> <add key="DEBUGCleanFile" value="true"/> </appSettings>
9
4273
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. Is it programatically possible in VB.NET to read the contents of web.config's <customErrorselement? I looked at using ConfigurationSettings.AppSettings, but that doesn't work. I need to read the value of redirect from the error statusCode 404. My web.config looks like this: <customErrors mode="RemoteOnly" defaultRedirect="Error.aspx"> <error statusCode="404" redirect="Error404.aspx" /> </customErrors>
1
2192
by: Sergei Shelukhin | last post by:
Hi. Is is possible to divide appSetting in two, having some values stored in web.config itself and some in a section referenced in appSettings file="...." attribute?
2
2790
by: remya1000 | last post by:
i'm using VB.NET 2003. Last time while i did a program in Vb.Net 2005, i use "Configuration". and i could read and write to that XML configuration file like the example below. CODES: Imports System.Configuration Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10163
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10104
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8988
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.