The ASP.NET Web application that has the impersonation element set to true in the Web.config file, and that has the authentication element set to Windows in the Web.config file, runs under the impersonated account. The code in the ASP.NET Web application connects to an Access database. When the connection is made, the Microsoft Jet OLE DB creates temporary files in the Temp folder in the following directory:
Document and Settings\ServerName\ASPNET\Local settings
where ServerName is the name of your server.
If the impersonated user account does not have read/write permissions enabled in the Temp folder, you receive the error message that is mentioned in the "Symptoms" section.
To resolve this problem, enable read/write permissions for the impersonated user account in the Temp folder. To do this, follow these steps:
Right-click the Temp folder, and then click Properties.
In the Properties dialog box, click the Security tab.
On the Security tab, click Add, and then type ServerName\UserAccount in the Select Users or Groups text box, where ServerName is the name of your server, and where UserAccount is the name of the impersonated account. Click OK.
Click to select the Read and the Write check boxes, and then click OK.
This behavior is by design.
Steps to Reproduce the Behavior
Create a new ASP.NET Web application. To do this, follow these steps:
Start Microsoft Visual Studio .NET.
Create a new Microsoft Visual C# .NET or a new Microsoft Visual Basic .NET ASP.NET Web Application. Name the project SampleApplication.
Write the code in the SampleApplication file to connect to the Access database.
Set the authentication mode to Windows. To do this, follow these steps:
In Solution Explorer, double-click Web.config.
Under the <System.web> section, modify the authentication element as follows:
<authentication mode="Windows" />
Set the impersonation element to true. To do this, follow these steps:
Under the <System.web> section, add the impersonation element as follows:
<identity impersonate="true" />
Save, and then close the Web.config file.
On the Build menu, click Build SampleApplication.
Set the authentication method on the application. To do this, follow these steps:
Click Start, and then click Run.
In the Open text box, type inetmgr, and then click OK.
In the Internet Information Services dialog box, click Default Web Site.
Right-click SampleApplication, and then click Properties.
In the SampleApplication Properties dialog box, click the Directory Security tab.
Under Anonymous access and authentication control, click Edit.
In the Authentication Methods dialog box, click to select the Anonymous Access check box. Make sure that the User name text box has the UserAccount value, where UserAccount is a Windows account. Click OK two times, and then close the Internet Information Services dialog box.
Make sure that read/write permissions for UserAccount are not enabled in the following folder: