The class project is called from a console app, windows service, windows
frame application, etc. Even if you associate the app.config with your class
lib project, when you compile you need to rename the app.config file into
"YOUR_APP.config.exe", where you would have to replace "YOUR_APP" with your
application's name.
In your case it returns null because it is not able to find the app.config
file and read from it.

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of Hevel, Shawn
Sent: Monday, October 02, 2006 10: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

Reply via email to