Script Tips

Saturday, 07 October 2006 03:32

Security - DNS or DNSLess

Written by 
Rate this item
(0 votes)

Security - DNS or DNSLess

Choosing which method to use depends on your hosting company.

First lets look at the typical structure of a hosting account.
Most hosts will have a setup that looks like the following:

                     logs \
                     ( where above is your public root - some hosts will name it differently)

You are expected to place your database in the database directory and your Web files (index.html, main.html etc) in the directory.
IIS which comes with Windows 2003 has defaulted allow parent directories to off.
This is a security issue since this can allow script to access all directories if not set properly.
Some hosting companies will not change the default settings which limits a DNSLess connection to using the Web Root directory.
If this is the case for your hosting company then DNS is the best way to go else you must place the database within you Web root.
The safest place to place files for maximum security is in your account root!

For a DNS connection you must setup an ODBC Data Source.
If your control panel allows this then you can set it up yourself else you must request it from your host support people.
strconn = "DSN=my-dataname"
Set dbc = Server.CreateObject("ADODB.Connection") strconn

For a DNSLess connection you only need to set the connection string to the file location.
s_db_filename = "\database\my-database-filename"
s_db_path = Server.MapPath(s_db_filename)
strconn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & s_db_path
Set dbc = Server.CreateObject("ADODB.Connection") strconn

Vincent Gabriele

Read 7783 times Last modified on Wednesday, 22 April 2015 19:49

1 comment

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.