Encrypting SOME application settings

Discussion in 'ASP .Net' started by BillAtWork, Sep 29, 2009.

  1. BillAtWork

    BillAtWork Guest

    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!
    BillAtWork, Sep 29, 2009
    #1
    1. Advertising

  2. On Sep 29, 4:57 pm, BillAtWork <> wrote:
    > 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
    Alexey Smirnov, Sep 29, 2009
    #2
    1. Advertising

  3. BillAtWork

    BillAtWork Guest

    Thank you. Looks great.

    "Alexey Smirnov" wrote:

    > On Sep 29, 4:57 pm, BillAtWork <> wrote:
    > > 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
    >
    BillAtWork, Sep 29, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Damian
    Replies:
    3
    Views:
    12,486
    Jim Cheshire [MSFT]
    Dec 30, 2003
  2. Replies:
    0
    Views:
    357
  3. Siegfried Heintze
    Replies:
    0
    Views:
    2,257
    Siegfried Heintze
    Oct 24, 2005
  4. leeanne
    Replies:
    0
    Views:
    1,842
    leeanne
    Sep 24, 2008
  5. donet programmer
    Replies:
    3
    Views:
    1,518
    Gregory A. Beamer
    Nov 20, 2009
Loading...

Share This Page