Asp. NET database programming processing file Access License

Source: Internet
Author: User
Tags mdb database access database

An MDB database is another file on your hard disk, so, like any other file, it will encounter the same file Access License issue. This question means to read (and write, as you will see later in this book) the database file in which the application running on the page must have permission to read (and write) the file in Windows.

So far, the reason that the pages in the example can "run properly" is that you are using the VWD Web Server, a lightweight program that runs under the identity of a user running VWD. This means that the VWD Web server is running for you, and you have been allowed to read and write to the MDB file for the page connection.

However, when you run the page under IIS, the situation is a little more complicated. At this point, the ASP. NET page runs under the identity of a user account with a specific permission limit. Under IIS 5.1, this account is "ASPNET". In IIS 6.0 or later, this account is "network Service" and belongs to a Windows user group called IIS_WPG ("worker process Group"). In order to use an Access database under IIS, these accounts must grant permission to read from the directory that contains the MDB file, as well as to grant write permission.

To help you create these licenses, when the database is under the App_Data subdirectory under the application root directory, VWD performs additional steps and automatically grants the license to the ASPNET or Network Service account. If you are using VWD to develop a page on your machine, this particular directory will always be granted the correct license. The App_Data directory also has other benefits, such as preventing any file from responding to a requesting web browser. This means that after placing the MDB file in the application's local App_Data directory, you can protect the files from being inadvertently or intentionally downloaded by the application's clients. Therefore, we strongly recommend that you save the MDB file to the App_Data directory.

If you must save the MDB file to a different location, or you need to manually specify the permissions for the database directory (for example, if you are working on a remote Web server), you can use Windows to configure permissions for the ASP.net and/or network service accounts.

If you want to manually set up permissions, follow the steps below:

(1) Use Windows Explorer to browse the folder where the MDB file resides.

(2) Right-click the directory and select Properties.

(3) Select the Security tab and click the Add button.

(4) Add the local asp.net account (IIS 5.1) or the IIS_WPG group (IIS 6).

(5) Click OK, and then apply the relevant license to this directory.

For more information, see the white paper named "Running asp.net 1.1 and IIS 6.0", which can be obtained from the ASP.net Web site: http://www.asp.net/faq/AspNetAndIIS6.aspx.

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.