impersonation and ado access connection

Discussion in 'ASP .Net Security' started by Chance Hopkins, Oct 5, 2003.

  1. 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?
     
    Chance Hopkins, Oct 5, 2003
    #1
    1. Advertisements

  2. Chance Hopkins

    Paul Clement Guest

    On Sun, 5 Oct 2003 18:24:23 -0400, "Chance Hopkins" <> wrote:

    ¤ 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 ~~~
    Microsoft MVP (Visual Basic)
     
    Paul Clement, Oct 6, 2003
    #2
    1. Advertisements

  3. 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.



    "Paul Clement" <> wrote in message news:...
    > On Sun, 5 Oct 2003 18:24:23 -0400, "Chance Hopkins" <> wrote:
    >
    > ¤ 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 ~~~
    > Microsoft MVP (Visual Basic)
     
    Chance Hopkins, Oct 6, 2003
    #3
  4. Chance Hopkins

    Paul Clement Guest

    On Mon, 6 Oct 2003 14:34:14 -0400, "Chance Hopkins" <> wrote:

    ¤
    ¤ 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 ~~~
    Microsoft MVP (Visual Basic)
     
    Paul Clement, Oct 7, 2003
    #4

  5. >
    > 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.
     
    Chance Hopkins, Oct 7, 2003
    #5
  6. Chance Hopkins

    Paul Clement Guest

    On Tue, 7 Oct 2003 15:33:00 -0400, "Chance Hopkins" <> wrote:

    ¤
    ¤ >
    ¤ > 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 ~~~
    Microsoft MVP (Visual Basic)
     
    Paul Clement, Oct 8, 2003
    #6
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nita
    Replies:
    1
    Views:
    955
    Saravana
    Nov 20, 2004
  2. ronaldlee

    Transfer ADO Code to ADO.NET

    ronaldlee, Dec 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    539
    Kevin Spencer
    Dec 17, 2004
  3. Replies:
    0
    Views:
    1,415
  4. Navin
    Replies:
    1
    Views:
    867
    Ken Schaefer
    Sep 9, 2003
  5. CJM
    Replies:
    2
    Views:
    136
Loading...

Share This Page