impersonation and ado access connection

C

Chance Hopkins

I am implementing impersonation in my machine.config for IIS application Isolation of the ASPNET worker process.

I am giving the new account the same permissions to files and folders that the aspnet account had.

Everything works great....EXCEPT. All connections to access databases break.

Anyone know why?
 
P

Paul Clement

¤ I am implementing impersonation in my machine.config for IIS application Isolation of the ASPNET worker process.
¤
¤ I am giving the new account the same permissions to files and folders that the aspnet account had.
¤
¤ Everything works great....EXCEPT. All connections to access databases break.
¤

Could you be more specific? What do you mean by "break"? What is the error message that is being
generated?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
C

Chance Hopkins

All I get is this:

Exception Details: System.Data.OleDb.OleDbException: Unspecified error

The stack trace offers no info, other than the fact that it stops when it tries to open the connection to the database.

I'm adding this in the machine.config, and appropriate NTFS permissions for the account I'm impersonating to the web directory and
bin :

<location path="Web Site Name/VDirName" allowOverride="false" >
<system.web>
<identity impersonate="true" userName="something" password="something" />
<system.web>
<location>


It works for anything that DOESN'T have an access database. To rule out NTFS issues, I went so far as to give EVERYONE full control
(with replace permissions on all child objects) for one entire site. That didn't help either. It's definitely not an NTFS issue.

I'm lost, thx for the replies.
 
P

Paul Clement

¤
¤ All I get is this:
¤
¤ Exception Details: System.Data.OleDb.OleDbException: Unspecified error
¤
¤ The stack trace offers no info, other than the fact that it stops when it tries to open the connection to the database.
¤
¤ I'm adding this in the machine.config, and appropriate NTFS permissions for the account I'm impersonating to the web directory and
¤ bin :
¤
¤ <location path="Web Site Name/VDirName" allowOverride="false" >
¤ <system.web>
¤ <identity impersonate="true" userName="something" password="something" />
¤ <system.web>
¤ <location>
¤
¤
¤ It works for anything that DOESN'T have an access database. To rule out NTFS issues, I went so far as to give EVERYONE full control
¤ (with replace permissions on all child objects) for one entire site. That didn't help either. It's definitely not an NTFS issue.
¤
¤ I'm lost, thx for the replies.
¤

Can you post your connection string and the line of code where the error is generated?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
C

Chance Hopkins

Can you post your connection string and the line of code where the error is generated?


sure, this is what I'm using for a connection:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\dir\myAccess.mdb;Jet OLEDB:Database Password=mypassword;

and I'm just calling a datareader from a function like this, with a "SELECT * FROM TableName;":

public static OleDbDataReader ReturnDataReader(string varQuery, string ConnectionString)
{
OleDbConnection connDB = new OleDbConnection(ConnectionString);
connDB.Open();
OleDbCommand commDB = new OleDbCommand(varQuery, connDB);
return commDB.ExecuteReader(CommandBehavior.CloseConnection);
}

it dies on .Open() with the impersonation.
 
P

Paul Clement

¤
¤ >
¤ > Can you post your connection string and the line of code where the error is generated?
¤
¤
¤ sure, this is what I'm using for a connection:
¤
¤ Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\dir\myAccess.mdb;Jet OLEDB:Database Password=mypassword;
¤
¤ and I'm just calling a datareader from a function like this, with a "SELECT * FROM TableName;":
¤
¤ public static OleDbDataReader ReturnDataReader(string varQuery, string ConnectionString)
¤ {
¤ OleDbConnection connDB = new OleDbConnection(ConnectionString);
¤ connDB.Open();
¤ OleDbCommand commDB = new OleDbCommand(varQuery, connDB);
¤ return commDB.ExecuteReader(CommandBehavior.CloseConnection);
¤ }
¤
¤ it dies on .Open() with the impersonation.

The ConnectionString you posted has a syntax problem in the path to the database (no escape
characters):

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\dir\\myAccess.mdb;Jet
OLEDB:Database Password=mypassword;";

Also, I'm assuming that you're supplying the valid database password in your connection string?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

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
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top