connectionstring in global.asax or web.config?

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
 
J

Jason Hales

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
 
M

Mark Rae

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...:)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top