473,605 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ConfigurationSe ttings.AppSetti ngs[" ConfigurationSe ttings.AppSetti ngs"]

Ken
I'm currently using 1.1.
Is there any way using the value of a
ConfigurationSe ttings.AppSetti ngs["something"] as a key of
ConfigurationSe ttings.AppSetti ngs[ConfigurationSe ttings.AppSetti ngs["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 = ConfigurationSe ttings.AppSetti ngs["car"] .ToString();

string car =
ConfigurationSe ttings.AppSetti ngs[ConfigurationSe ttings.AppSetti ngs["car"] ].Tostring();


May 14 '07 #1
1 5809
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 = ConfigurationSe ttings.AppSetti ngs["car"] ;
string car = ConfigurationSe ttings.AppSetti ngs[company ];

or

ConfigurationSe ttings.AppSetti ngs[
ConfigurationSe ttings.AppSetti ngs["car"] ]
There is no need to use ToString() as a string is already being returned.

"Ken" <kl**@jeromegro up.comwrote in message
news:u9******** ******@TK2MSFTN GP05.phx.gbl...
I'm currently using 1.1.
Is there any way using the value of a
ConfigurationSe ttings.AppSetti ngs["something"] as a key of
ConfigurationSe ttings.AppSetti ngs[ConfigurationSe ttings.AppSetti ngs["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 = ConfigurationSe ttings.AppSetti ngs["car"] .ToString();

string car =
ConfigurationSe ttings.AppSetti ngs[ConfigurationSe ttings.AppSetti ngs["car"]
].Tostring();


May 14 '07 #2

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

Similar topics

2
15475
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> <appsettings> <add key="PasswordProvider" value="fudge" /> </appsettings>
5
20853
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 <appSettings> entries in the file though, I get null back for properties. config file <configuration> <appSettings> <add key="mySetting" value="hello_world" /> ....
14
5906
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 MyBase.Load 'This event routine in the loginCheck user control fires when the
0
1347
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 = (System.Configuration.ConfigurationSettings.AppSettings.GetValues("mailserver")); //Get data from page string toAddress =
6
6096
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 I received an error message: "The ConnectionString property has not been initialized.
2
1435
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:" & System.Configuration.ConfigurationSettings.AppSettings.Get("WebMasterEmail") ) %> The Email part of the string prints out but not the WebMasterEmail property of the AppSettings.
2
1785
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 security=SSPI;database=NDD"/>
8
2633
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 = ConfigurationSettings.AppSettings Once your application has called for the "foo" key once, how expensive is to call the same line again? My gut tells me that the CLR likely stores these values in memory in a string dictionary or similar. Looking up the value requires the...
1
13129
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 version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="Setting1" value="Very" />
0
8001
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
8415
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
8069
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
8286
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6742
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
5886
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
5445
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
3912
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...
1
2438
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.