Connection String: Global.asax vs. web.config file

Discussion in 'ASP .Net' started by D. Shane Fowlkes, Jan 12, 2004.

  1. Upon reading through my ASP.NET book, I've learned how to place the
    connection string in both locations in my application. Just due to habit, I
    naturally want to place my SQL Server connection string in the asax
    file...but are there really advantages to having in one file over the other?

    Thanks
     
    D. Shane Fowlkes, Jan 12, 2004
    #1
    1. Advertising

  2. Your web.config file is generally considered a better place because it's a
    simple text file that is easily updated without needing to recompile
    anything and changes go into effect immediately.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net
    Hire top-notch developers at http://www.able-consulting.com



    "D. Shane Fowlkes" <> wrote in message
    news:%...
    > Upon reading through my ASP.NET book, I've learned how to place the
    > connection string in both locations in my application. Just due to habit,

    I
    > naturally want to place my SQL Server connection string in the asax
    > file...but are there really advantages to having in one file over the

    other?
    >
    > Thanks
    >
    >
     
    Steve C. Orr [MVP, MCSD], Jan 12, 2004
    #2
    1. Advertising

  3. D. Shane Fowlkes

    Jeremy Guest

    I agree.

    I use the web.config file because in our environment I
    have to move an application from development to staging
    (for testing) and then up to production. So rather than
    making the change in the asax file and recompiling every
    time before pushing the application up to the next stage I
    just open the web.config and make the change.

    I guess it's all just preference, whatever you feel most
    comfortable in doing, but I vote for web.config

    Jeremy

    >-----Original Message-----
    >Your web.config file is generally considered a better

    place because it's a
    >simple text file that is easily updated without needing

    to recompile
    >anything and changes go into effect immediately.
    >
    >--
    >I hope this helps,
    >Steve C. Orr, MCSD, MVP
    >http://Steve.Orr.net
    >Hire top-notch developers at http://www.able-

    consulting.com
    >
    >
    >
    >"D. Shane Fowlkes" <> wrote

    in message
    >news:%...
    >> Upon reading through my ASP.NET book, I've learned how

    to place the
    >> connection string in both locations in my application.

    Just due to habit,
    >I
    >> naturally want to place my SQL Server connection string

    in the asax
    >> file...but are there really advantages to having in one

    file over the
    >other?
    >>
    >> Thanks
    >>
    >>

    >
    >
    >.
    >
     
    Jeremy, Jan 12, 2004
    #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. Brian Henry

    web.config and global.asax

    Brian Henry, Oct 26, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    348
    Alvin Bruney
    Oct 28, 2003
  2. Ruslan
    Replies:
    6
    Views:
    473
    Ruslan
    Dec 16, 2003
  3. =?Utf-8?B?YmNoYXJsZXM=?=

    global.asax and global.asax.cs

    =?Utf-8?B?YmNoYXJsZXM=?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    861
    =?Utf-8?B?YmNoYXJsZXM=?=
    Oct 5, 2004
  4. Mark Rae

    Global.asax / Global.asax.cs in v2

    Mark Rae, May 23, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    3,185
    Mark Rae
    May 23, 2006
  5. Alias
    Replies:
    0
    Views:
    976
    Alias
    Feb 15, 2007
Loading...

Share This Page