Encrypting SOME application settings

  • Thread starter Thread starter BillAtWork
  • Start date Start date
B

BillAtWork

Hi,
I'm looking for a tidy approach to this. I have a number of asp.net
application settings stored in web.config and I'd like to encrypt SOME of
them but not all of them!

e.g.
<appSettings>
<add key="ANiceMessage" value="Hello Everyone"/>
<add key="AnotherMessage" value="Hi Again"/>
<add key="databaseconnectionstring" value="dontwantyoutoreadthis"/>
</appSettings>

I'd like to be able to encrypt just the database connection and yet leave
the other keys accessible so that they can be changed if required.

Is there a way to do that or do I have to encrypt the whole section to take
advantage of the automatic decryption provided by asp.net? Is there a tidy
alternative i.e. so that I can access all settings via
ConfigurationSettings.AppSettings["key"]?

Thanks!
 
Hi,
I'm looking for a tidy approach to this. I have a number of asp.net
application settings stored in web.config and I'd like to encrypt SOME of
them but not all of them!

e.g.
  <appSettings>
    <add key="ANiceMessage" value="Hello Everyone"/>
    <add key="AnotherMessage" value="Hi Again"/>
    <add key="databaseconnectionstring" value="dontwantyoutoreadthis"/>
  </appSettings>

I'd like to be able to encrypt just the database connection and yet leave
the other keys accessible so that they can be changed if required.

Is there a way to do that or do I have to encrypt the whole section to take
advantage of the automatic decryption provided by asp.net? Is there a tidy
alternative i.e. so that I can access all settings via
ConfigurationSettings.AppSettings["key"]?

Thanks!

Put the secret key to the special section (out of appSettings) like it
is explain here
http://odetocode.com/Blogs/scott/archive/2006/01/08/2707.aspx

then you could simply use aspnet_regiis
 
Thank you. Looks great.

Alexey Smirnov said:
Hi,
I'm looking for a tidy approach to this. I have a number of asp.net
application settings stored in web.config and I'd like to encrypt SOME of
them but not all of them!

e.g.
<appSettings>
<add key="ANiceMessage" value="Hello Everyone"/>
<add key="AnotherMessage" value="Hi Again"/>
<add key="databaseconnectionstring" value="dontwantyoutoreadthis"/>
</appSettings>

I'd like to be able to encrypt just the database connection and yet leave
the other keys accessible so that they can be changed if required.

Is there a way to do that or do I have to encrypt the whole section to take
advantage of the automatic decryption provided by asp.net? Is there a tidy
alternative i.e. so that I can access all settings via
ConfigurationSettings.AppSettings["key"]?

Thanks!

Put the secret key to the special section (out of appSettings) like it
is explain here
http://odetocode.com/Blogs/scott/archive/2006/01/08/2707.aspx

then you could simply use aspnet_regiis
 
Back
Top