Asp. NET to prevent Access database from downloading

Source: Internet
Author: User
Tags anonymous config iis modify net access database access root directory
access|asp.net| Data | database | Download How to prevent Access database downloads is a very old topic, and there are more discussions on the Web. Here is only to explore the asp.net to prevent access to the database is downloaded methods, some of the previous method of summary, part of their original. There may be imperfections or even incorrect places, you are welcome to point out the progress together.
  
The current solutions are mainly as follows:
  
1. Put the database file outside the site Directory
  
2. Set IIS directory permissions for database files to be unreadable (IIS Information Services admin-> Select need to set directory-> right--> Properties-> Directory tab-> cancel read check box)
  
3. Use ODBC data source
  
All of the above three methods are more classic and more secure, suitable for the direct operation of the server situation (because three methods need to directly operate the server to set up), of course, this is the ASP platform to prevent access to download the solution.
  
Another solution under the ASP platform is to add a Long Binary tab to the database and modify the file suffix to. ASP. (Details can refer to the corresponding data table of the Dynamic Network Forum database)
  
4. Rename your Access *.asax: Because the asp.net processing mechanism, by default, such requests are rejected directly, and there will be no resource-consuming problems with the parsing process Shi mentioned. In this way, you can also rename Access to *.config,*.vb, *.cs, and so on.
  
5. Place your Access in the bin directory under your application root (that is, the directory where you put the DLL file): It has been found that IIS is configured by default to deny direct access to files in the bin directory to secure requests for DLLs, and in fact protects other text in the bin directory Thing But for this method, some people question: will have such a consequence, the database reads and writes will cause the assembly to be frequently refreshed, also will session and application unceasingly loses
  
6. (Personal originality) Another method is to use. NET access control to prohibit anonymous users to download the database, as follows:
  
Open the configuration file Web.config and add the following configuration under the configuration node:
  
<;location path= "DataBase" >
  
<;system.web>
  
<;authorization>
  
<;deny users= "*"/>
  
<;/authorization>
  
<;/system.web>
  
<;/location>
  
DB is your database file storage directory, if it is the root directory with <;locateon path= "~/database.aspx" > replace it. Add the above configuration and then modify the database suffix to. aspx, such as file types that need to be resolved by IIS.
  
Because the <;deny users= "*"/> statement restricts any anonymous user access path path= All files that need to be resolved under "DataBase."
  
Note: either ASP or. NET, directly to the Access database suffix directly to the. ASP and. aspx, or add a "#" in front of the filename or a space in the file name, using FlashGet.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.