473,406 Members | 2,371 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,406 software developers and data experts.

ConfigurationSettings.AppSettings[" ConfigurationSettings.AppSettings"]

Ken
I'm currently using 1.1.
Is there any way using the value of a
ConfigurationSettings.AppSettings["something"] as a key of
ConfigurationSettings.AppSettings[ConfigurationSettings.AppSettings["something"].Tosting(
)]?

for example in web.config
<add key="company" value="Hyundai" />

<add key="Hyundai" value="sonata" />

in cs code, How should I change the the code for "string car"?

string company = ConfigurationSettings.AppSettings["car"] .ToString();

string car =
ConfigurationSettings.AppSettings[ConfigurationSettings.AppSettings["car"] ].Tostring();


May 14 '07 #1
1 5793
Hi,

I do not understand your post, of course you can use the value of a key as
the key for another value:

string company = ConfigurationSettings.AppSettings["car"] ;
string car = ConfigurationSettings.AppSettings[company ];

or

ConfigurationSettings.AppSettings[
ConfigurationSettings.AppSettings["car"] ]
There is no need to use ToString() as a string is already being returned.

"Ken" <kl**@jeromegroup.comwrote in message
news:u9**************@TK2MSFTNGP05.phx.gbl...
I'm currently using 1.1.
Is there any way using the value of a
ConfigurationSettings.AppSettings["something"] as a key of
ConfigurationSettings.AppSettings[ConfigurationSettings.AppSettings["something"].Tosting(
)]?

for example in web.config
<add key="company" value="Hyundai" />

<add key="Hyundai" value="sonata" />

in cs code, How should I change the the code for "string car"?

string company = ConfigurationSettings.AppSettings["car"] .ToString();

string car =
ConfigurationSettings.AppSettings[ConfigurationSettings.AppSettings["car"]
].Tostring();


May 14 '07 #2

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

Similar topics

2
by: hazz | last post by:
I have spent more time than I care to admit trying to track down a very subtle error. Here is my app's xx.exe.config file. <?xml version="1.0" encoding="utf-8" ?> <configuration>...
5
by: Derrick | last post by:
I have a C# console app, MyApp, and am placing an application config file in the same debug dir as MyApp.exe. I have named the file MyApp.config, and MyApp.exe.config. I cannot read the...
14
by: dale zhang | last post by:
Hi groups, Can anyone give me the equivalent C# sharp code for this VB.ET code, :: VB.NET :: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles...
0
by: desi.american | last post by:
I'm using System.Web.Mail to send an email message from an ASP.NET web page. This is the main section of the code. //************* start code ***************************** string mailHost =...
6
by: Tony | last post by:
Dear All, When I run an example program on the http://www.dotnetjunkies.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/data/datagrid1.src&file=VB\datagrid1.aspx&font=3 ...
2
by: RSH | last post by:
Hi, I have a situation where I am attempting to print the contents of an AppSettings property in the aspx file of my website. Basically here is the code I am using: <% Response.Write("Email:"...
2
by: lauralucas | last post by:
Hello I'm trying to use a connection string stored in web.config here is the web.config part <appSettings> <add key="NDDbase" value="Server=SOMESERVER\\SOMEINSTANCE;integrated...
8
by: Mark | last post by:
Could someone provide me with details or a link on how the line of code executes underneath the hood? Assume it's executed in an ASP.NET application. string blah =...
1
by: sandy.82in | last post by:
Hi I'm new to C# , I'm using VS2005 and .NET2.0 .Here is my issue i just developed a simple application with app.config , and a simple class library and following is my app.configfile <?xml...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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...

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.