Prevent ACCESS Database Downloadments in .NET
How to prevent Access database from downloading is a very old topic, and there is more discussion on the Internet. Here is just to explore the method of preventing the Access database from being downloaded under ASP.NET, some is a summary of the previous method, and part is original. Among them, there may be imperfect or even incorrectly, welcome everyone to make a progress together.
The current solutions have the following:
1. Place the database file outside the site directory
2. Set the IIS directory permissions stored in the database file for the unreadable (IIS Information Service Management -> Select Set Directory -> Right Key -> Properties -> Directory Tab -> Cancel Read check box)
3. Adopt ODBC data source
The above three methods are more secure, suitable for the case of direct operation of the server (because three methods require direct operation of the server), of course, this is also the solution to prevent Access to be downloaded under the ASP platform.
There is also a solution under the ASP platform, which is to add a long binary table in the database, and then modify the file suffix to .asp. (For details, refer to the corresponding data sheet for the mobile network forum database)
4. Rename your Access * .asax: Because ASP.NET's processing mechanism, by default, the request is directly rejected, and there will be no resource consumption of resource-consuming resources mentioned. According to this idea, you can also rename the Access * .config, *. VB, * .cs, etc.
5. Place your Access under your application root bin directory (that is, you put the DLL file): I have found that IIS defaults to reject files in bin directory directly to protect the pair DLL's request, in fact, also protects other files in a bin directory. But for this approach, some people ask questions: there will be no such consequences, the database will cause the assembly to refresh, which will continue to be lost in Session and Application
6. (Individual Original) Another method is to use the access to the .NET access to the purpose of prohibiting anonymous users from downloading the database, as follows:
Open the configuration file Web.config, add the following configuration under the Configuration node:
authorization>
location>
Database is your database file storage directory, if it is root directory, you can use Because the Note: Whether it is in the ASP or .NET, add a space directly to the Access database suffix directly to .asp and .aspx, or add a "#" or file name in front of the file name, use FlashGet. related articles: Simple problem http://blog.joycode.com/saucer/archive/2003/10/18/2795.aspx Several options to prevent Access databases from being downloaded in ASP.NET http://blog.joyercode.com/percyboy/articles/7470.aspx Stop the rumor about "to prevent the ACCESS database downloaded" http://blog.joyercode.com/percyboy/archive/2004/10/26/36657.aspx