473,486 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Retrieving DSN from Config file...

Hi:

I created a config file to retrieve DSN at runtime from a C# library project
(DLL). I name the file same as DLL (libRADIUS.config). Here is the
contents of the file...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="dsn" value="server=arwen;uid=;pwd=;database=dbRadius" />
</appSettings>
</configuration>

I'm accessing from a class using...

string dsn = ConfigurationSettings.AppSettings["dsn"];

The problem is that it always returns null. Does anybody know why?

Thanks,
Charlie
Nov 16 '05 #1
3 2165
You cannot map a config file to a DLL, only an EXE or website.

"Charlie" <cf*******@radiustravel.com> wrote in message
news:OY**************@TK2MSFTNGP11.phx.gbl...
Hi:

I created a config file to retrieve DSN at runtime from a C# library project (DLL). I name the file same as DLL (libRADIUS.config). Here is the
contents of the file...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="dsn" value="server=arwen;uid=;pwd=;database=dbRadius" />
</appSettings>
</configuration>

I'm accessing from a class using...

string dsn = ConfigurationSettings.AppSettings["dsn"];

The problem is that it always returns null. Does anybody know why?

Thanks,
Charlie

Nov 16 '05 #2
Interesting. Then how do you store application configuration settings that
you want to be able to change without recompiling DLL?

Charlie
"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:ec****************@TK2MSFTNGP15.phx.gbl...
You cannot map a config file to a DLL, only an EXE or website.

"Charlie" <cf*******@radiustravel.com> wrote in message
news:OY**************@TK2MSFTNGP11.phx.gbl...
Hi:

I created a config file to retrieve DSN at runtime from a C# library

project
(DLL). I name the file same as DLL (libRADIUS.config). Here is the
contents of the file...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="dsn" value="server=arwen;uid=;pwd=;database=dbRadius" />
</appSettings>
</configuration>

I'm accessing from a class using...

string dsn = ConfigurationSettings.AppSettings["dsn"];

The problem is that it always returns null. Does anybody know why?

Thanks,
Charlie


Nov 16 '05 #3
Place the exact name/value setting that you have below in your app.config
for the application.

If there is no application, such as if this is a generic library, then this
will have to be part of the installation or instructions to the user to
ensure this gets added to the app.config.

DLLs can use configuration settings, but they come from the app.config file.

"Charlie" <cf*******@radiustravel.com> wrote in message
news:O5**************@TK2MSFTNGP09.phx.gbl...
Interesting. Then how do you store application configuration settings that you want to be able to change without recompiling DLL?

Charlie
"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:ec****************@TK2MSFTNGP15.phx.gbl...
You cannot map a config file to a DLL, only an EXE or website.

"Charlie" <cf*******@radiustravel.com> wrote in message
news:OY**************@TK2MSFTNGP11.phx.gbl...
Hi:

I created a config file to retrieve DSN at runtime from a C# library

project
(DLL). I name the file same as DLL (libRADIUS.config). Here is the
contents of the file...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="dsn" value="server=arwen;uid=;pwd=;database=dbRadius" />
</appSettings>
</configuration>

I'm accessing from a class using...

string dsn = ConfigurationSettings.AppSettings["dsn"];

The problem is that it always returns null. Does anybody know why?

Thanks,
Charlie



Nov 16 '05 #4

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

Similar topics

8
4486
by: Steve | last post by:
Can anyone tell me the preferred method for writing and retrieving persistent information using .Net. Specifically, I am referring to information that you used to see in registry keys or .ini...
1
3823
by: Dave | last post by:
Hello. I want to create some custom settings in my Web.config file and then retrieve it in my application, exactly I want to store some connection string for my database. I'm adding these...
1
1775
by: DS | last post by:
Hi all, Will appreciate if someone can help me with this problem. I am using VS 2003 on Win2000, sp 4. 2GB RAM. Session data is stored on DB on another machine in network. Can connect to the...
10
6879
by: Dan | last post by:
I use the settings grid to create a setting named "ServerName". Now i want to retrieve it in code and i can't figure out how. This should be incredibly obvious but i cant get it. I have tried...
3
16241
by: Harish | last post by:
I am buiding an application in ASP.Net 2.0 with C#. After installing corel wordperfect i am adding the reference into the application. Afetr adding reference interop.wordperfect.dll is added to the...
5
2620
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
1
1432
by: durai1117 | last post by:
i want one help from u friends my requirement is to store 2 values in app.config file i dnt know how to store in it. and next thing is i have to get that values and with that values i...
2
2630
by: | last post by:
I set up a TextWriterTraceListener in the App.config file. I'd like to be able to tell, programmatically, which file it's using. However, I don't seem to be able to get at the initializeData...
4
1373
balabaster
by: balabaster | last post by:
Okay, I need some inspiration to get me started on the implementation of an idea I've got. I want to specify in the config file of my .NET app that will give me a reference to a property on one of...
0
7123
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
7175
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...
1
6842
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...
0
7319
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...
1
4864
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...
0
4559
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...
0
3069
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...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.