database connection string...

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default database connection string...

    I want to store a database connection (includes username & password) for my
    asp.net app, currently I have it stored in the web.config file - I know this
    is not ideal but can anyone suggest a better place or way to store it.

    Cheers

    Eath Worm Jim


    Jim Guest

  2. Similar Questions and Discussions

    1. convert string to safe string before adding to database
      Hi I am updating a site for a client who is running CF5. The update and insert queries break when the user uses inverted commas ". I currently...
    2. ASP Connection String for Flatfile database?
      Hi All! Could someone please give me an example of a connection string for a flat file database or point me to a good resource for how I can...
    3. DB Connection String
      Hi, I need to store the database connection string inside web.config file. What would be the best way to encrypt and decrypt it? Thanks, Ali
    4. Connection String to connect to SQL Server Database
      http://www.able-consulting.com/ADO_Conn.htm Brian Staff
    5. database connection string encryption and decryption
      Hi I want to encrypt the database connection string and add it to web.config file. Before connecting to the database I want to decrypt it. Can...
  3. #2

    Default Re: database connection string...

    You could create a .dll and store it there. If you use a .dll you can also
    encrypt your username and password. I don't think you can do that if you
    put it in the Web.config file.. This is probably not the ideal way of
    storing a connectionstring either, but it's the best I can come up with.
    Hopefully someone else can show us a better way?

    Shawn


    "Jim" <ssss> wrote in message news:uh$yFkEpDHA.1708@TK2MSFTNGP12.phx.gbl...
    I want to store a database connection (includes username & password) for my
    asp.net app, currently I have it stored in the web.config file - I know this
    is not ideal but can anyone suggest a better place or way to store it.

    Cheers

    Eath Worm Jim



    Shawn Guest

  4. #3

    Default Re: database connection string...

    Why is it not ideal?

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    [url]http://www.takempis.com[/url]
    Big Things are made up of
    Lots of Little Things.

    "Jim" <ssss> wrote in message news:uh$yFkEpDHA.1708@TK2MSFTNGP12.phx.gbl...
    > I want to store a database connection (includes username & password) for
    my
    > asp.net app, currently I have it stored in the web.config file - I know
    this
    > is not ideal but can anyone suggest a better place or way to store it.
    >
    > Cheers
    >
    > Eath Worm Jim
    >
    >

    Kevin Spencer Guest

  5. #4

    Default Re: database connection string...

    Jim,

    The best practice for this is to use DPAPI.

    Check out
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT08.asp[/url]

    -Steve

    Jim wrote:
    > I want to store a database connection (includes username & password) for my
    > asp.net app, currently I have it stored in the web.config file - I know this
    > is not ideal but can anyone suggest a better place or way to store it.
    >
    > Cheers
    >
    > Eath Worm Jim
    >
    >
    Steve Jansen Guest

  6. #5

    Default Re: database connection string...

    ..Net has a rich set of Cryptography class. Choose a symmetric algo like
    triple des or md5 to keep encrypted conn string in the web.config and
    decrypt upon usage. Also note if anyboxy decompiled the application dll
    which employs this decryption, can see the password. So u will have to do
    one more level like obfuscation of the dll.

    "Shawn" <bossman100@hotmail.com> wrote in message
    news:uMS$NvEpDHA.2416@TK2MSFTNGP10.phx.gbl...
    > You could create a .dll and store it there. If you use a .dll you can
    also
    > encrypt your username and password. I don't think you can do that if you
    > put it in the Web.config file.. This is probably not the ideal way of
    > storing a connectionstring either, but it's the best I can come up with.
    > Hopefully someone else can show us a better way?
    >
    > Shawn
    >
    >
    > "Jim" <ssss> wrote in message
    news:uh$yFkEpDHA.1708@TK2MSFTNGP12.phx.gbl...
    > I want to store a database connection (includes username & password) for
    my
    > asp.net app, currently I have it stored in the web.config file - I know
    this
    > is not ideal but can anyone suggest a better place or way to store it.
    >
    > Cheers
    >
    > Eath Worm Jim
    >
    >
    >

    Rajesh.V Guest

  7. #6

    Default Re: database connection string...

    If the web server is hacked and the root directory is exposed then the
    hacker will have username and password to the database.

    Is that not a scenario I should be concerned about?

    Earth Worm Jim


    "Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> wrote in message
    news:eYcYNaHpDHA.1672@TK2MSFTNGP09.phx.gbl...
    > Why is it not ideal?
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > [url]http://www.takempis.com[/url]
    > Big Things are made up of
    > Lots of Little Things.
    >
    > "Jim" <ssss> wrote in message
    news:uh$yFkEpDHA.1708@TK2MSFTNGP12.phx.gbl...
    > > I want to store a database connection (includes username & password) for
    > my
    > > asp.net app, currently I have it stored in the web.config file - I know
    > this
    > > is not ideal but can anyone suggest a better place or way to store it.
    > >
    > > Cheers
    > >
    > > Eath Worm Jim
    > >
    > >
    >
    >

    Jim Guest

  8. #7

    Default Re: database connection string...

    > If the web server is hacked and the root directory is exposed then the
    > hacker will have username and password to the database.
    >
    > Is that not a scenario I should be concerned about?
    If you replace "web server" with any other server entity, you will see the
    flaw in your logic. Examples:

    If the database is hacked...
    If the file system is hacked...
    If the registry is hacked...

    If anything containing data is hacked, of course, the data is compromised.
    The trick is to protect your server from hackers.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    [url]http://www.takempis.com[/url]
    Big Things are made up of
    Lots of Little Things.

    "Jim" <ssss> wrote in message news:uGfkaxRpDHA.1408@TK2MSFTNGP11.phx.gbl...
    > If the web server is hacked and the root directory is exposed then the
    > hacker will have username and password to the database.
    >
    > Is that not a scenario I should be concerned about?
    >
    > Earth Worm Jim
    >
    >
    > "Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> wrote in message
    > news:eYcYNaHpDHA.1672@TK2MSFTNGP09.phx.gbl...
    > > Why is it not ideal?
    > >
    > > --
    > > HTH,
    > >
    > > Kevin Spencer
    > > Microsoft MVP
    > > .Net Developer
    > > [url]http://www.takempis.com[/url]
    > > Big Things are made up of
    > > Lots of Little Things.
    > >
    > > "Jim" <ssss> wrote in message
    > news:uh$yFkEpDHA.1708@TK2MSFTNGP12.phx.gbl...
    > > > I want to store a database connection (includes username & password)
    for
    > > my
    > > > asp.net app, currently I have it stored in the web.config file - I
    know
    > > this
    > > > is not ideal but can anyone suggest a better place or way to store it.
    > > >
    > > > Cheers
    > > >
    > > > Eath Worm Jim
    > > >
    > > >
    > >
    > >
    >
    >

    Kevin Spencer Guest

  9. #8

    Default Re: database connection string...

    I agree with what you are saying ......

    BUT lets say a serious flaw is found in IIS (my prefered web server) and
    this allows the hack access at the root of the website and they then gain
    the username & password from the web.config, they can destroy\delete data in
    the database,but where as if the connection string is protected by
    encryption or another means and they can't decrypt the string they can not
    gain access to the databse and therefore not destroy\delete data.

    I suppose I am thinking of another level of misdirection for the hacker...

    Cheers

    Earth Worm Jim


    "Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> wrote in message
    news:eQ$nfrSpDHA.2808@TK2MSFTNGP10.phx.gbl...
    > > If the web server is hacked and the root directory is exposed then the
    > > hacker will have username and password to the database.
    > >
    > > Is that not a scenario I should be concerned about?
    >
    > If you replace "web server" with any other server entity, you will see the
    > flaw in your logic. Examples:
    >
    > If the database is hacked...
    > If the file system is hacked...
    > If the registry is hacked...
    >
    > If anything containing data is hacked, of course, the data is compromised.
    > The trick is to protect your server from hackers.
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > [url]http://www.takempis.com[/url]
    > Big Things are made up of
    > Lots of Little Things.
    >
    > "Jim" <ssss> wrote in message
    news:uGfkaxRpDHA.1408@TK2MSFTNGP11.phx.gbl...
    > > If the web server is hacked and the root directory is exposed then the
    > > hacker will have username and password to the database.
    > >
    > > Is that not a scenario I should be concerned about?
    > >
    > > Earth Worm Jim
    > >
    > >
    > > "Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> wrote in message
    > > news:eYcYNaHpDHA.1672@TK2MSFTNGP09.phx.gbl...
    > > > Why is it not ideal?
    > > >
    > > > --
    > > > HTH,
    > > >
    > > > Kevin Spencer
    > > > Microsoft MVP
    > > > .Net Developer
    > > > [url]http://www.takempis.com[/url]
    > > > Big Things are made up of
    > > > Lots of Little Things.
    > > >
    > > > "Jim" <ssss> wrote in message
    > > news:uh$yFkEpDHA.1708@TK2MSFTNGP12.phx.gbl...
    > > > > I want to store a database connection (includes username & password)
    > for
    > > > my
    > > > > asp.net app, currently I have it stored in the web.config file - I
    > know
    > > > this
    > > > > is not ideal but can anyone suggest a better place or way to store
    it.
    > > > >
    > > > > Cheers
    > > > >
    > > > > Eath Worm Jim
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    Jim Guest

  10. #9

    Default Re: database connection string...

    Also
    [url]http://msdn.microsoft.com/msdnmag/issues/03/11/ProtectYourData/default.aspx[/url]
    may give you some ideas.

    Alek

    "Steve Jansen" <stj3571-nntp@y.a.h.o.o> wrote in message
    news:OYbeH2JpDHA.1084@tk2msftngp13.phx.gbl...
    > Jim,
    >
    > The best practice for this is to use DPAPI.
    >
    > Check out
    >
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT08.asp[/url]
    >
    > -Steve
    >
    > Jim wrote:
    >
    > > I want to store a database connection (includes username & password) for
    my
    > > asp.net app, currently I have it stored in the web.config file - I know
    this
    > > is not ideal but can anyone suggest a better place or way to store it.
    > >
    > > Cheers
    > >
    > > Eath Worm Jim
    > >
    > >
    >

    Alek Davis Guest

  11. #10

    Default database connection string...

    A comprehensive discussion of this topic can be found
    here:

    [url]http://msdn.microsoft.com/library/default.asp?[/url]
    url=/library/en-us/dnnetsec/html/SecNetch12.asp

    >-----Original Message-----
    >I want to store a database connection (includes username
    & password) for my
    >asp.net app, currently I have it stored in the
    web.config file - I know this
    >is not ideal but can anyone suggest a better place or
    way to store it.
    >
    >Cheers
    >
    >Eath Worm Jim
    >
    >
    >.
    >
    richlm Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139