Scroll To Top

Enter a query to search our site. Note that you can use "*" and "?" as wildcards. Enclosing more than one word in double quotes ("CSS Layout") will search for the exact phrase.

PVII Knowledge Base

1. Select a product ...
2. Select category ...
3. Search the Knowledge Base...

Question #61

How do I protect by Access database (.mdb) for not being downloaded from my website?

The Answer

Prepared Jul. 2001 by Gerry Jacobsen, PVII

There are several ways to protect your database:

1) You could locate your database outside of the web server, ie: C:\MyData\mydatabase.mdb and then reference that directory in connFile.asp by replacing the Server.MapPath lines with:

strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyData\mydatabase.mdb;"

Also, be sure to set a userid and password in Access to protect the database itself. The connection string would then read:

strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyData\mydatabase.mdb;UID=MyUserID;PWD=MyPassword;"

2) For the ultimate in security you should use a DSN, that DSN should point to a database server with the proper security settings (userid and password, file permissions, etc.), if the data is for commerce or contains sensitive info, you should use SQL7.

The ASP page that contains the connection string cannot be viewed since the server strips the ASP code before it sends it to the browser.

3) An alternative is to configure HTTP READ-Protected Folders. For a great article on this method visit:

http://www.4guysfromrolla.com/webtech/022300-1.shtml

A final note, remember that users generally will not know the name or the location of the database. Simply changing the name and/or the location will usually prevent any download attempts by users that will "guess" the name.

Back to the questions list