Permissions Error When Accessing Access Database

Discussion in 'ASP .Net' started by Nathan Sokalski, Jun 29, 2007.

  1. When I attempt to access a Microsoft Access database from my website, I
    recieve the following error:

    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    Security Exception
    Description: The application attempted to perform an operation not allowed
    by the security policy. To grant this application the required permission
    please contact your system administrator or change the application's trust
    level in the configuration file.

    Exception Details: System.Security.SecurityException: Request for the
    permission of type 'System.Data.OleDb.OleDbPermission, System.Data,
    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.


    Take note that the description says that this can be fixed by modifying the
    configuration file, which I am assuming is referring to the Web.config file.
    I have successfully run this application on my machine using Visual Studio
    2005's Development Server with the settings currently in the Web.config
    file, so if modifying the Web.config file will fix it, what do I need to
    change? Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
    Nathan Sokalski, Jun 29, 2007
    #1
    1. Advertising

  2. On Jun 29, 2:50 am, "Nathan Sokalski" <> wrote:
    > When I attempt to access a Microsoft Access database from my website, I
    > recieve the following error:
    >
    > Server Error in '/' Application.
    > ---------------------------------------------------------------------------­-----
    >
    > Security Exception
    > Description: The application attempted to perform an operation not allowed
    > by the security policy. To grant this application the required permission
    > please contact your system administrator or change the application's trust
    > level in the configuration file.
    >
    > Exception Details: System.Security.SecurityException: Request for the
    > permission of type 'System.Data.OleDb.OleDbPermission, System.Data,
    > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
    >
    > Take note that the description says that this can be fixed by modifying the
    > configuration file, which I am assuming is referring to the Web.config file.
    > I have successfully run this application on my machine using Visual Studio
    > 2005's Development Server with the settings currently in the Web.config
    > file, so if modifying the Web.config file will fix it, what do I need to
    > change? Thanks.
    > --
    > Nathan Sokalski
    > ://www.nathansokalski.com/



    Why do you use OleDb for MS Access?

    http://msdn2.microsoft.com/en-us/library/system.data.oledb.oledbconnection.aspx

    An application that creates an instance of the OleDbConnection object
    can require all direct and indirect callers to have sufficient
    permission to the code by setting declarative or imperative security
    demands. OleDbConnection makes security demands using the
    OleDbPermission object. Users can verify that their code has
    sufficient permissions by using the OleDbPermissionAttribute object.
    Users and administrators can also use the Code Access Security Policy
    Tool (Caspol.exe) to modify security policy at the computer, user, and
    enterprise levels. For more information, see Code Access Security and
    ADO.NET.

    http://msdn2.microsoft.com/en-us/library/0x4t63kb.aspx
    Alexey Smirnov, Jun 29, 2007
    #2
    1. Advertising

  3. I use OleDb for MS Access because of the namespaces that are included in the
    ..NET Framework (or that I have ever heard of from third parties)
    System.Data.OleDb is the one that is supposed to be used when accessing a MS
    Access database. The reason I am using MS Access for this website rather
    than a higher quality database such as SQL Server or Oracle is because the
    organization the site is for cannot afford anything else.

    I have used System.Data.OleDb for MS Access databases in other sites I have
    written, such as my personal website, with no problem, and any books that I
    have read that use MS Access as their example database have as well, so I
    know that it is the right one to use.

    I have never had to deal with any of the objects you mention (except for
    OleDbConnection, of course). Could you please either give me a code sample
    or direct me to a site that gives one? Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "Alexey Smirnov" <> wrote in message
    news:...
    On Jun 29, 2:50 am, "Nathan Sokalski" <> wrote:
    > When I attempt to access a Microsoft Access database from my website, I
    > recieve the following error:
    >
    > Server Error in '/' Application.
    > ---------------------------------------------------------------------------­-----
    >
    > Security Exception
    > Description: The application attempted to perform an operation not allowed
    > by the security policy. To grant this application the required permission
    > please contact your system administrator or change the application's trust
    > level in the configuration file.
    >
    > Exception Details: System.Security.SecurityException: Request for the
    > permission of type 'System.Data.OleDb.OleDbPermission, System.Data,
    > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
    >
    > Take note that the description says that this can be fixed by modifying
    > the
    > configuration file, which I am assuming is referring to the Web.config
    > file.
    > I have successfully run this application on my machine using Visual Studio
    > 2005's Development Server with the settings currently in the Web.config
    > file, so if modifying the Web.config file will fix it, what do I need to
    > change? Thanks.
    > --
    > Nathan Sokalski
    > ://www.nathansokalski.com/



    Why do you use OleDb for MS Access?

    http://msdn2.microsoft.com/en-us/library/system.data.oledb.oledbconnection.aspx

    An application that creates an instance of the OleDbConnection object
    can require all direct and indirect callers to have sufficient
    permission to the code by setting declarative or imperative security
    demands. OleDbConnection makes security demands using the
    OleDbPermission object. Users can verify that their code has
    sufficient permissions by using the OleDbPermissionAttribute object.
    Users and administrators can also use the Code Access Security Policy
    Tool (Caspol.exe) to modify security policy at the computer, user, and
    enterprise levels. For more information, see Code Access Security and
    ADO.NET.

    http://msdn2.microsoft.com/en-us/library/0x4t63kb.aspx
    Nathan Sokalski, Jun 29, 2007
    #3
  4. Nathan Sokalski

    Mark Rae Guest

    "Alexey Smirnov" <> wrote in message
    news:...

    > Why do you use OleDb for MS Access?


    How else would you expect to use a Jet database within the .NET
    Framework...???


    --
    http://www.markrae.net
    Mark Rae, Jun 29, 2007
    #4
    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. Scott Allen
    Replies:
    0
    Views:
    431
    Scott Allen
    Jul 13, 2004
  2. =?Utf-8?B?UMOlbCBFaWxlcnRzZW4=?=

    Error accessing MS Access database with Linked Tables on fileshare

    =?Utf-8?B?UMOlbCBFaWxlcnRzZW4=?=, Apr 21, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    644
    =?Utf-8?B?UMOlbCBFaWxlcnRzZW4=?=
    Apr 21, 2006
  3. Curt K
    Replies:
    0
    Views:
    562
    Curt K
    Nov 3, 2006
  4. Gilles LAMBERT
    Replies:
    2
    Views:
    122
    Jacob Yang [MSFT]
    Oct 23, 2003
  5. Carol

    Permissions - Access database

    Carol, Jul 7, 2004, in forum: ASP General
    Replies:
    3
    Views:
    118
    Carol
    Jul 8, 2004
Loading...

Share This Page