ASPASP.NET网站中怎么防止Access数据库被别人下载
如何防止Access数据库下载是一个很老的话题了,网上的讨论也比较多。这里我们给出几种在ASP.NET下防止Access数据库被下载的方法。 我们这里假设Access数据库名字为 test.mdb。 1、把数据库放在WEB目录外 如你的网站目录是D:www,你可以把数据库放到D:data 这
如何防止Access数据库下载是一个很老的话题了,网上的讨论也比较多。这里我们给出几种在ASP.NET下防止Access数据库被下载的方法。
我们这里假设Access数据库名字为 test.mdb。
1、把数据库放在WEB目录外
如你的网站目录是D:www,你可以把数据库放到D:data 这个文件夹里,然后修改网站程序中的数据库连接字串地址部分为:"D:datatest.mdb" ,这样数据库可以正常调用,但是无法下载的,因为它不在网站目录里。
假设在web.config中配置数据库连接字符串。例如:
2、把数据库放在App_Data系统文件夹下
从.Net2.0开始有App_Data目录来专门存放数据文件,它可以用来放Access,SQL Server Express、XML等数据文件。数据库文件放到App_Data文件夹的好处就是可以防止被下载。而对于连接字符串数据库的文件位置可以使用DataDirectory关键来表示它的物理路径,从而在获取连接字符串的时候不再需要使用Server.MapPath()转换。
假设在web.config中配置数据库连接字符串。例如:
|DataDirectory|就是代表的app_data文件夹。
3、重命名数据库文件
将你的 Access 重命名 *.asax:因为 ASP.NET 的处理机制中,默认情况下,对这样的请求是直接拒绝的。按照这个思路,还可以把 Access 重命名为 *.config,*.vb, *.cs 等等。
4、配置IIS,添加.mdb文件类型映射
添加.mdb的扩展映射这个方法就是通过修改IIS设置来实现。只需2个步骤。
1. 配置IIS,将.mdb文件类型映射到ASP.NET ISAPI。
以windows 2003为例,点击“开始”-》运行-》输入“inetmgr” 回车,打开“Internet 服务管理器”。在某一个网站上单击鼠标右键-》点击“属性” 弹出此站点的属性对话框。点击“主目录”选项卡,点击“配置”按钮,则会显示“应用程序配置”对话框。点击“添加”增加一个映射,这时会显示一个对话框,要你输入可执行文件:“C:WINDOWS Microsoft.NET Framework v2.0.50727 aspnet_isapi.dll”;输入扩展名:“.mdb”。如下图所示
2. 配置asp.net的web.config文件,将.mdb文件类型映射到HttpForbiddenHandler HTTP handler。
使asp.net应用程序.mdb文件类型映射到HttpForbiddenHandler HTTP 句柄。为了达到这上步,必须将下面的配置加到Web.config文件中
5、添加ACCESS防下载字段
该方法的原理是:将数据库的扩展名变成.aspx格式,从远程访问这个文件的时候,IIS服务器就会把它当成aspx程序来执行,而我们之前在ACCESS数据库中插入了“”标记中才能执行,所以就会出现 “缺少脚本关闭标记” 的500错误,别人就无法下载ACCESS数据库了。如果只是简单的在数据库的文本或者备注字段加入“
1、先创建一个表,在SQL命令窗口内输入如下内容:“create table [notdown]([notdown] oleobject)”
然后点击工具栏中的“!”(运行),这样,就会在当前数据库内创建一个“notdown”表,其中的字段名称为“notdown”,字段类型为“OLE对象”。 如图1
(图1)
2、将SQL查询窗口中的内容更改为如下命令:“insert into [notdown](notdown) values (0x3C25)”
这一句的意思是向“notdown”表的“notdown”字段中插入“0x3C25”数据(“0x3C25”为字符“
(图2)
执行完毕后,再次查看数据库中的“表”,,就会发现其中已多了一个“notdown”表,打开后字段显示的是“长二进制数据” 如图3
(图3)
admin10000.com 这里已经做好的防下载数据表notdown,你可以直接下载粘贴到自己数据库中使用。notdown数据表
提示1:无论是ASP网站中还是ASP.NET网站,对于直接把Access数据库后缀直接改为.asp和.aspx,用FlashGet等下载工具都照下不误,不能起到防下载作用。
提示2:第5种方法通常用在ASP+ACCESS网站中。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











How to configure Zend in Apache? The steps to configure Zend Framework in an Apache Web Server are as follows: Install Zend Framework and extract it into the Web Server directory. Create a .htaccess file. Create the Zend application directory and add the index.php file. Configure the Zend application (application.ini). Restart the Apache Web server.

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

VprocesserazrabotkiveB-enclosed, Мнепришлостольностьсясзадачейтерациигооглапидляпапакробоглесхетсigootrive. LEAVALLYSUMBALLANCEFRIABLANCEFAUMDOPTOMATIFICATION, ČtookazaLovnetakProsto, Kakaožidal.Posenesko

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

Apache server is a powerful web server software that acts as a bridge between browsers and website servers. 1. It handles HTTP requests and returns web page content based on requests; 2. Modular design allows extended functions, such as support for SSL encryption and dynamic web pages; 3. Configuration files (such as virtual host configurations) need to be carefully set to avoid security vulnerabilities, and optimize performance parameters, such as thread count and timeout time, in order to build high-performance and secure web applications.

Nginx performance monitoring and troubleshooting are mainly carried out through the following steps: 1. Use nginx-V to view version information, and enable the stub_status module to monitor the number of active connections, requests and cache hit rate; 2. Use top command to monitor system resource occupation, iostat and vmstat monitor disk I/O and memory usage respectively; 3. Use tcpdump to capture packets to analyze network traffic and troubleshoot network connection problems; 4. Properly configure the number of worker processes to avoid insufficient concurrent processing capabilities or excessive process context switching overhead; 5. Correctly configure Nginx cache to avoid improper cache size settings; 6. By analyzing Nginx logs, such as using awk and grep commands or ELK

The Nginx current limit problem can be solved by: use ngx_http_limit_req_module to limit the number of requests; use ngx_http_limit_conn_module to limit the number of connections; use third-party modules (ngx_http_limit_connections_module, ngx_http_limit_rate_module, ngx_http_access_module) to implement more current limit policies; use cloud services (Cloudflare, Google Cloud Rate Limiting, AWS WAF) to DD
