You can't use an app.config w/ a class library project, because you cannot
run the class library. You can however have one app.config associated with
your application (console, win frame, win service) and another app.config
associated with your class library (.dll). You can link the class lib's
app.config in the app's app.config. There was a limitation in VS2003 where
you could link only one class lib app.config file in an app's app.config and
another limitation where you could only have up to two files linked like
this (the class lib's app.config was not allowed to link another class lib
app.config file). Obviously, when you deploy the application, you need to do
a lot of renaming. I have done this in the past and is not big deal.
I haven't checked whether the limitation still exists in VS2005.

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of Pardee, Roy
Sent: Monday, October 02, 2006 4:15 PM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] SQL connection information - Encryption


I don't think you can use an app.config w/a class library project.

You can probably have your .dll seek out and/or create a particular text
file for users to set up conn strings in, but my advice would be to code
your class to accept connection strings from clients, and make encrypting
those the clients' problem.  The clients can use the stock app.config goo,
so it's not much of a hardship on them.

HTH,

-Roy

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Hevel, Shawn
Sent: Monday, October 02, 2006 7:31 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] SQL connection information - Encryption

There is but can you still use an App.Config file in a class.  I've tried it
but when I add the code to read the settings I continue to get null.  I am
successful in reading an App.Config file in a Console application but not a
Class Project.



Shawn Hevel, API, AIT
Lead Programmer Analyst
Information Technology Department
South Carolina Farm Bureau Insurance Companies
Phone: (803) 936-4331
Fax: (803) 936-4629
Work Email: [EMAIL PROTECTED]
Home Email: [EMAIL PROTECTED]


-----Original Message-----
From: Phil Sayers [mailto:[EMAIL PROTECTED]
Sent: Monday, October 02, 2006 10:26 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] SQL connection information - Encryption

if this is for framework 2.0...

isn't there a new connectionstrings section in the config files?...i'd swear
i've seen something about automagic encryption in certain places in the
config files.

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of Eddie Lascu
Sent: Monday, October 02, 2006 9:56 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] SQL connection information - Encryption


Yes, windows authentication is the way to go. However, if for whatever
reasons you still want the connection string somewhere else, look at the
Enterprise Library - Data Access Application Block. There is a sample there
that shows you how to store the connection string in the app.config file
(actually it is in the dataconfiguration.config) and encrypt that section of
the configuration file.
Regards,
Eddie

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of Phil Sayers
Sent: Monday, October 02, 2006 9:10 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] SQL connection information - Encryption


keep the database server name only in the config file.
...optionally keep the database name in the config fie.

use windows integrated authentication to connect to the sql server.  with
the sql account options, you can set a default database...or make sure you
use 4 part naming to explicitly specify which database your sql code is
using...

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of Hevel, Shawn
Sent: Monday, October 02, 2006 9:01 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: [ADVANCED-DOTNET] SQL connection information - Encryption


I have a class that needs to connect to a SQL Server Database.  How can I
encrypt my connection information without hard-coding the connection string
in the class?  I thought about using the App.Config file but I don't think
that is allowed because the class is not in an executable project?  Is that
correct statement?



What would be the best way to hide this connection information using
encryption?



Thanks for the help.



Shawn Hevel, API, AIT
Lead Programmer Analyst
Information Technology Department
South Carolina Farm Bureau Insurance Companies
Phone: (803) 936-4331
Fax: (803) 936-4629
Work Email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> Home
Email: [EMAIL PROTECTED]




===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to