connectionstring in global.asax or web.config?

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Hi,

i was wondering whether i would use global.asax or web.config for the
connectionstring to the database. I put this in global.asax.

Sub Application_Start
Application("Connect") = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\mydb.mdb;"
End Sub

In web.config, i added:
<appSettings>
<add key="newres" value"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\mydb.mdb;"/>
</appSettings>


What's the best way (speed, resources ..) according to you?

Thanks
bob
 
It's much easier to put in web.config. That way you don't need to
recompile each time the connection string changes. Just edit
web.config and away you go

The downside is that web.config is an xml file which is humanly
readable so any passwords will be visible anyone that can access your
web site's content files locally

IIS will not serve up the web.config file though -
http://mywebsite.com/web.config will result in an server error

Bear in mind that MS Access is not particulartly scalable as a database
if you're epecting many concurrent visitors
 
use web.config, thats what its for.
Agreed.

If your worried about security then ecnypt it......

Bear in mind that this will (almost certainly) not be possible on a public
site hosted by a 3rd-party ISP, as the account they give you to upload your
files will (almost certainly) not have sufficient privileges to run
aspnet_regiis, even if you somehow manage to pop a command window...:-)
 
Back
Top