How to Enable Impersonation

G

Guest

I have been working my way through an ASP.NET tutorial and I find that any
code that attempts to update an Access table evokes the error: "Operation
must use an updateable query."

A search of the MSDN Knowledge Base turned up an article describing my
problem exactly and recommending that I

(a) Configure the ASP.NET worker proces to run under the SYSTEM account in
the <processModel> section of the Machine.config file.

or

(b) For security reasons, Microsoft recommends that you enable impersonation
on your ASP.NET application. This method works if the impersonated user has
necessary permissions to the computer and the database that you are accessing.

Unfortunately, I have been unable to find any information on how to
accomplish either of the above. I'm new to .NET and am still feeling my way
around. I'd greatly appreciate any advice.
 
J

Juan T. Llibre

That happens most commonly because the account ASP.NET
is using doesn't have write privileges to the directory where
the Access .MDB file is located.

An .LDB security file needs to be created in the same directory
where the .MDB file resides.

That will happen whether you impersonate or not,
since whichever account ASP.NET is running as
will need write permission to the directory.

Try giving the ASP.NET account write privileges to the directory
where the Access .MDB is located.
 
D

Derek Harmon

Sheldon Penner said:
A search of the MSDN Knowledge Base turned up an article describing my
problem exactly and recommending that I : :
(b) For security reasons, Microsoft recommends that you enable impersonation
Unfortunately, I have been unable to find any information on how to
accomplish either of the above.

Option (a) was inadvisable because it gives ASPNET blanket power over your
system.

To enable impersonation for option (b), you just need to open the "web.config"
file in your web application and add an <identity> element under <system.web>
like this,

<identity impersonate="true" />

For more information, see the following help topics in the .NET Framework SDK,

http://msdn.microsoft.com/library/en-us/cpguide/html/cpconaspnetimpersonation.asp
http://msdn.microsoft.com/library/en-us/cpgenref/html/gngrfidentitysection.asp


Derek Harmon
 
G

Guest

Thanks for your response, Derek. I have added a web.config file to the root
of the test application, as you advised, and I find that I still get the same
"...updateable query" message. However, if I specify my user name and
password in the identity tag, the data update succeeds without an error.

 
G

Guest

Thank you for your message, Juan. I tried your suggestion of giving the
ASP.NET account write privileges in the directory containing the mdb file,
but no dice, I continue to get the same error.

Derek Harmon wrote suggesting I create a web.config file and include an
identity tag containing 'impersonate="true"'. I find that this works if I
also specify my login name and password; otherwise, same old error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top