There is a problem with Access databases in the background of developing a company's OA system recently.
In order to prevent the database from downloading for malicious people, you need to change the database suffix name aspx (ASP, etc.), and the company insiders need to download the database through IE to backup the database.
Of course, there is not a particularly secure way to hide a database by modifying the file name suffix, after all, the database in M and the ASPX page in K can be seen as a database or a Web page at a glance. However, it is a simple and easy way to do it.
First of all, simply modifying the database file suffix name aspx does not guarantee that it will not be downloaded, and you can restore the database by downloading the ASPX page and then modifying it back to the suffix name. (As mentioned earlier, it is obvious to see which pages are faked by the database.)
Here you need to do something about this modified file, plus <%%>, and you can have IIS treat it as an ASPX page and return an error instead of downloading it. Can not be simply added, you need to first create a text file containing <%%>, and then add a table in the original database, add an OLE Object field, and then add a record, the contents of the OLE Object field to the previous text created.
Then it's about how your internal people are going to download the database properly. Pass. NET HttpResponse object to the client to enter the database file to implement the download.
To modify an HTTP header:
HttpContext.Current.Response.AppendHeader ("Content-disposition", "Attachment;filename=backup.mdb");
HttpContext.Current.Response.ContentType = "Application/ms-access";
To enter a file to the client:
Long FileSize = new FileInfo (dbpath). Length;
Response.WriteFile (dbpath, 0, FileSize);
That's basically it.