Access database authentication

Discussion in 'ASP .Net' started by James, Dec 21, 2003.

  1. James

    James Guest

    I'm having this problem with an ASP.NET web service
    (C#)... can anyone help please?

    My connection string is:

    Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:System
    Database=" + Server.MapPath("Secured.mdw") +@"; Data
    source=" + Server.MapPath("TMIData.mdb") +@"; User
    ID=james; Password=pass; Persist Security Info=true

    to access the database through OleDb. The connection is
    made with an XML web service.

    For some reason, all works fine when the web service is
    referenced 'offline' ("using TMI_Webcomm"), but not when
    it is called with a web reference ("using
    TMI_Management.localhost"), as if it were on a server.

    The error occurs when the following code is run:

    oleDbDataAdapter1.Fill(this.dataSet1, "Users");

    ....and the message reads:

    -----------------------------------------------------

    An unhandled exception of
    type 'System.Web.Services.Protocols.SoapException'
    occurred in system.web.services.dll

    Additional information:
    System.Web.Services.Protocols.SoapException: Server was
    unable to process request. --->
    System.Data.OleDb.OleDbException: You do not have the
    necessary permissions to use
    the 'C:\Inetpub\wwwroot\TMIData.mdb' object. Have your
    system administrator or the person who created this
    object establish the appropriate permissions for you.
    at System.Data.OleDb.OleDbConnection.ProcessResults
    (Int32 hr)
    at System.Data.OleDb.OleDbConnection.InitializeProvider
    ()
    at System.Data.OleDb.OleDbConnection.Open()
    at System.Data.Common.DbDataAdapter.QuietOpen
    (IDbConnection connection, ConnectionState& originalState)
    at System.Data.Common.DbDataAdapter.FillFromCommand
    (Object data, Int32 startRecord, Int32 maxRecords, String
    srcTable, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataSet
    dataSet, Int32 startRecord, Int32 maxRecords, String
    srcTable, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataSet
    dataSet, String srcTable)
    at TMI_Webcomm.TMIWebcomm.UserAccessLevel(String
    UserID, String Password) in c:\inetpub\wwwroot\tmi
    webcomm\service1.asmx.cs:line 51

    -----------------------------------------------------

    I assure you that this is a problem with the user
    authentication, as all works fine without database
    security. It's also kinda wierd that the problem only
    occurs when the web service is called through a web
    reference.

    Any ideas, anyone????

    Please help!

    James
     
    James, Dec 21, 2003
    #1
    1. Advertising

  2. Does the ASPNET account (or whatever account the Web service runs as) have
    write privileges to the folder where the Access database is located? If not,
    Access can't create its locking file and things fall apart.


    "James" <> wrote in message
    news:027101c3c763$435f13a0$...
    > I'm having this problem with an ASP.NET web service
    > (C#)... can anyone help please?
    >
    > My connection string is:
    >
    > Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:System
    > Database=" + Server.MapPath("Secured.mdw") +@"; Data
    > source=" + Server.MapPath("TMIData.mdb") +@"; User
    > ID=james; Password=pass; Persist Security Info=true
    >
    > to access the database through OleDb. The connection is
    > made with an XML web service.
    >
    > For some reason, all works fine when the web service is
    > referenced 'offline' ("using TMI_Webcomm"), but not when
    > it is called with a web reference ("using
    > TMI_Management.localhost"), as if it were on a server.
    >
    > The error occurs when the following code is run:
    >
    > oleDbDataAdapter1.Fill(this.dataSet1, "Users");
    >
    > ...and the message reads:
    >
    > -----------------------------------------------------
    >
    > An unhandled exception of
    > type 'System.Web.Services.Protocols.SoapException'
    > occurred in system.web.services.dll
    >
    > Additional information:
    > System.Web.Services.Protocols.SoapException: Server was
    > unable to process request. --->
    > System.Data.OleDb.OleDbException: You do not have the
    > necessary permissions to use
    > the 'C:\Inetpub\wwwroot\TMIData.mdb' object. Have your
    > system administrator or the person who created this
    > object establish the appropriate permissions for you.
    > at System.Data.OleDb.OleDbConnection.ProcessResults
    > (Int32 hr)
    > at System.Data.OleDb.OleDbConnection.InitializeProvider
    > ()
    > at System.Data.OleDb.OleDbConnection.Open()
    > at System.Data.Common.DbDataAdapter.QuietOpen
    > (IDbConnection connection, ConnectionState& originalState)
    > at System.Data.Common.DbDataAdapter.FillFromCommand
    > (Object data, Int32 startRecord, Int32 maxRecords, String
    > srcTable, IDbCommand command, CommandBehavior behavior)
    > at System.Data.Common.DbDataAdapter.Fill(DataSet
    > dataSet, Int32 startRecord, Int32 maxRecords, String
    > srcTable, IDbCommand command, CommandBehavior behavior)
    > at System.Data.Common.DbDataAdapter.Fill(DataSet
    > dataSet, String srcTable)
    > at TMI_Webcomm.TMIWebcomm.UserAccessLevel(String
    > UserID, String Password) in c:\inetpub\wwwroot\tmi
    > webcomm\service1.asmx.cs:line 51
    >
    > -----------------------------------------------------
    >
    > I assure you that this is a problem with the user
    > authentication, as all works fine without database
    > security. It's also kinda wierd that the problem only
    > occurs when the web service is called through a web
    > reference.
    >
    > Any ideas, anyone????
    >
    > Please help!
    >
    > James
     
    Ken Cox [Microsoft MVP], Dec 22, 2003
    #2
    1. Advertising

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. MSDN
    Replies:
    0
    Views:
    694
  2. Fernando Lopes
    Replies:
    0
    Views:
    875
    Fernando Lopes
    Mar 29, 2005
  3. JC
    Replies:
    3
    Views:
    613
    =?ISO-8859-2?Q?Dra=BEen_Gemi=E6?=
    Jun 19, 2006
  4. Tony Johansson
    Replies:
    7
    Views:
    544
    Gregory A. Beamer
    Dec 23, 2009
  5. Fabricio Sperandio

    Impersonate, Windows Authentication and Database Access

    Fabricio Sperandio, Apr 5, 2004, in forum: ASP .Net Security
    Replies:
    1
    Views:
    152
    Andrea D'Onofrio [MSFT]
    Apr 14, 2004
Loading...

Share This Page