473,320 Members | 1,535 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,320 software developers and data experts.

How to read info from xml in asp.net component ?

I am writing a component like dropdownlist whose content should be read from
xml,and i put the path of the xml file into the web.config fallow as
---------------------------------------------------------------------------------------
<configuration>

<appSettings>
<add key="LocalizedCountryFileDirectory" value="D:\Location" />
</appSettings>
</configuration
---------------------------------------------------------------------------------------

and i read it in this way:
============================================

String filePath =
ConfigurationSettings.AppSettings["LocalizedCountryFileDirectory"];

===============================================
But it sames not to work, can u give me some suggestion to make it work , or
give me some other way to the the path. your answer will be appreciated.
thanx !
Nov 22 '05 #1
1 852
I don't see anything wrong with your code to read the file path in, I use the
same mechanism frequently and it works fine.

The only thing I can see from your code that might cause a problem is that
it has a single backslash "\" character. Depending on how you attempt to use
the string you have read in, you may get an exception as the CLR will
interpret the backslash as an escape and apply it to the following character.
So it will be trying to apply some special meaning to \L which will may
cause an exception, but at least give you unexpected behaviour.

What do you do with the string once you have read it in from the config file?

Regards
Mike Hanson

"zjut" wrote:
I am writing a component like dropdownlist whose content should be read from
xml,and i put the path of the xml file into the web.config fallow as :
---------------------------------------------------------------------------------------
<configuration>

<appSettings>
<add key="LocalizedCountryFileDirectory" value="D:\Location" />
</appSettings>
</configuration>
---------------------------------------------------------------------------------------

and i read it in this way:
============================================

String filePath =
ConfigurationSettings.AppSettings["LocalizedCountryFileDirectory"];

===============================================
But it sames not to work, can u give me some suggestion to make it work , or
give me some other way to the the path. your answer will be appreciated.
thanx !

Nov 22 '05 #2

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

Similar topics

2
by: Kingdom | last post by:
I have a SelectBoxes.asp page that is working with multiple selection dropdown boxes to extract data and total the selection prices. Tom & Bob were kind enough to give me a big help getting this...
1
by: serge calderara | last post by:
Dear all, I need to read certain assembly information from an application. I do not want to add the reference to those assembly inside my application. I have in my application a browse...
1
by: zjut | last post by:
I am writing a component like dropdownlist whose content should be read from xml,and i put the path of the xml file into the web.config fallow as...
1
by: Jonathan Turkanis | last post by:
Dear All, My latest library leads to a lot of internal errors and compiler limit errors (C1001, C1055, C1067) when compiled on VC7.1 with /Zi or /ZI. The library compiles on GCC 3.4.1, Comeau...
2
by: Jim Bancroft | last post by:
The answer's probably "no," but no harm in asking: Is it possible for a serviced component, running in a COM+ server package, to read the AppSettings of an aspx page that calls it? Here's an...
1
by: kpg | last post by:
Hi All, I have an asp.net project that uses an ActiveX component on the server side and I would like the login page to show the version number of this component. The ActiveX component is...
0
by: thecult | last post by:
Hi, this is my first post on this forum, I want to request all possible info and examples about using indy component on C++ Builder6 I have programmed some easy projects with this component but is...
3
by: Girish Kanakagiri | last post by:
Hi, Can anyone please provide me the info or the link for the following Requirements. When to use COM / DCOM How to Develop / Debug COM component What is Component Service
1
by: Sagar | last post by:
I want to write a program, that reads and logs the windows events that happened in a particular folder once every minute, 1. A file was created in the folder. which user created ? 2. A file was...
0
by: wildman | last post by:
Trying to read XML files from SSIS and load into SQL Server. I tested this before and it was working before I placed in a forevery contrainer. also, my simple xml file had to be retyped cause I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.