Link to home
Start Free TrialLog in
Avatar of epmo
epmo

asked on

Avoid file download from a server

how can you Avoid file download from a server when you type:  http://www.domain.com/database.mdb

Anyone can download the database?

Thanks.

Avatar of dr_binks
dr_binks

nope, all I get is some html & java code.
Avatar of epmo

ASKER

well, the above url is just an example, on ours it will save the dabatase to your disk
epmo,
Well, what do you want to happen when you go to that url? IE Can't view an .mdb file as far as I know...downloading it is all it can do.

You should put your database in a folder that is not accessible from the web. That is the only way to assure that people cannot download it.
Avatar of epmo

ASKER

Tanks  - yes, we do not want the database to be downloaded

> a folder that is not accessible from the web

and How do you do that?
are you using IIS or Apache?
Avatar of epmo

ASKER

IIS
>> a folder that is not accessible from the web
>and How do you do that?

 I am assuming this is a database used by some .asp pages to serve data via the web.

The important thing is that you can place the database file itself almost anywhere on the disk (but outside the folders accessible to the web server). For example, suppose the website is all in a folder named c:\web (and subfolders within c:\web). We may decide to put the database in a folder named c:\data.

The next step is to register your database as a data source with your system. This is done via the ODBC control panel (Control Panel -> Admin Tools -> Data Sources(ODBC)).
Click on "System DSN", then the Add button, and give it a suitable name and point it to your database in c:\data.

The final step is to use that name when accessing it from your .asp page.
For example, suppose we named it ACCOUNTS in the ODBC control panel, then you would use commands similar to the following in your web page:

Set connectionToDatabase=Server.CreateObject("ADODB.Connection")
connectionToDatabase.ConnectionTimeout=60
connectionToDatabase.Open "DSN=ACCOUNTS"

Further details need to be filled in by you, but this way you keep your database away from the website, and still be use the data from within a web page.

There are many ASP tutorials on the web. Here's a couple:

 http://www.w3schools.com/ado/default.asp
 http://www.sitepoint.com/article/build-faq-asp-ms-access/2
 http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=166

 etc.

 Good luck.


ASKER CERTIFIED SOLUTION
Avatar of DVation191
DVation191

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial