Results 1 to 18 of 18

Thread: [RESOLVED] Application Trust Level

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Resolved [RESOLVED] Application Trust Level

    Hi am extremely new to ASP.NET,
    And I thought the best way for me to pick up things was to jump in and have a go.
    I am not trying anything fancy, I am just trying to read data from a table in an Access Database using System.Data.OleDb

    when trying to retrieve any data from the db, I am receiving the following error message:

    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.
    I have tried searching for an answer, and I only seem to be able to find questions lol.

    Could anyone please advise on what I may be doing wrong.

    Thanks

  2. #2
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    Re: Application Trust Level

    Set the Trust level to FULL in your web.config.

    vb Code:
    1. <system.web>
    2.     <Trust Level= "Full" originUrl="" />
    3.   </system.web>
    Microsoft Techie

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Application Trust Level

    Where are you getting this error - on your machine or your web host?

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: Application Trust Level

    on the server

    gonna test the above now!

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: Application Trust Level

    Quote Originally Posted by pvbangera
    Set the Trust level to FULL in your web.config.

    vb Code:
    1. <system.web>
    2.     <Trust Level= "Full" originUrl="" />
    3.   </system.web>
    just tested this

    Code:
    <configuration>
        <system.web>        
        <customErrors mode="Off"/>
        <Trust Level= "Full" originUrl="" />
        </system.web>
    </configuration>
    and the error i am getting this error:

    Server Error
    500 - Internal server error.
    There is a problem with the resource you are looking for, and it cannot be displayed.
    am i doing something wrong?

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Application Trust Level

    Chances are, your host will not allow you to specify full trust for your application (unless you or your company owns the server).

    What is the name of your host? Is it netfirms by any chance? Netfirms, among other hosts will prevent OleDb access. Of course, we'll need to confirm this once you mention your host name.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: Application Trust Level

    Quantasoft Web Hosting is the company i'm using

    didnt wanna pay out for anything just yet, just wanted to get familiar first

    thanks for your help!

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Application Trust Level

    OK, so it seems like Quantasoft allows MS Access. However, I'm pretty sure you can't override your application's trust level, although you may try it.

    You should now probably show your code. As another troubleshooting step, create a basic application with a blank page or just a button and textbox on it and try to see if that works on your account. If that works, but this doesn't, then you know for sure it's a code problem which may be doing something that it's not allowed to do.

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: Application Trust Level

    i've got other asp.net controls in place
    got a button that redirects, few texts boxes

    it's just when i am trying to retrieve data and write...

    this is just a quick test i tried:

    vb Code:
    1. commandCW1 = new OleDbCommand("SELECT [PayNumber], [FirstName], [Surname], [ContractedHours], [StartDate], [LeaveList] FROM StaffList WHERE [PayNumber] = @PayNumber;")
    2.   commandCW1.Parameters.Add(new OleDbParameter("@PayNumber", OleDbType.Char)).Value = TextPayNumber.Text
    3.   commandCW1.Connection = connectionCW1
    4.  
    5.   connectionCW1.Open()
    6.  
    7.   readerCW1 = commandCW1.ExecuteReader()
    8.   If (readerCW1.Read()) Then
    9.     TextFirstName.Text = readerCW1.GetValue(0).ToString()      
    10.     'TextSupplier.Text = readerCW1.GetValue(1).ToString()
    11.     'TextQuantityPerUnit.Text = readerCW1.GetValue(2).ToString()
    12.     'TextUnitPrice.Text = readerCW1.GetValue(3).ToString()
    13.     'TextUnitsInStock.Text = readerCW1.GetValue(4).ToString()
    14.     'TextUnitsOnOrder.Text = readerCW1.GetValue(5).ToString()  
    15.     'TextReorderLevel.Text = readerCW1.GetValue(6).ToString()
    16.   End If

  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Application Trust Level

    So if the rest of the code works alright, we know that it's a problem with the fact that you're querying a database. I think you should now contact that web host and ask them about this. They have shown that they support MS Access, but they may be disallowing something else...

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: Application Trust Level

    an there's nothing wrong with the above code?

    i'll drop them a message shortly

    cheers mate

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: Application Trust Level

    anyone fancy translating? haha

    https://www.qsh.eu/view.aspx?keyid=faq

  13. #13
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Application Trust Level

    FAQ is currently in Slovak language only. English, Spanish, German and Polish will be available soon...
    Fascinating...

    I suppose you should use the contact form.

    https://www.qsh.eu/contactform

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: Application Trust Level

    yeah just filling it in now, cheers man

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: Application Trust Level

    For some reason the code is now working, but I had forgot to update the db on the server with the most recent copy off my hdd

    it's now "locked" (.ldb file is present in directory) and I can't access the db

    any ideas how to unlock the db?

    thanks
    Mitch

  16. #16
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Application Trust Level

    Delete the .ldb.

  17. #17

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: Application Trust Level

    Tried that lol

    each time my ftp client says it was succesful but on refresh the file is still there

  18. #18

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: Application Trust Level

    just unlocked itself

    i'll mark this as resolved now

    cheers for your help mendhak

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width