[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:
Quote:
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
Re: Application Trust Level
Set the Trust level to FULL in your web.config.
vb Code:
<system.web>
<Trust Level= "Full" originUrl="" />
</system.web>
Re: Application Trust Level
Where are you getting this error - on your machine or your web host?
Re: Application Trust Level
on the server
gonna test the above now!
Re: Application Trust Level
Quote:
Originally Posted by pvbangera
Set the Trust level to FULL in your web.config.
vb Code:
<system.web>
<Trust Level= "Full" originUrl="" />
</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:
Quote:
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? :(
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.
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!
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.
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:
commandCW1 = new OleDbCommand("SELECT [PayNumber], [FirstName], [Surname], [ContractedHours], [StartDate], [LeaveList] FROM StaffList WHERE [PayNumber] = @PayNumber;")
commandCW1.Parameters.Add(new OleDbParameter("@PayNumber", OleDbType.Char)).Value = TextPayNumber.Text
commandCW1.Connection = connectionCW1
connectionCW1.Open()
readerCW1 = commandCW1.ExecuteReader()
If (readerCW1.Read()) Then
TextFirstName.Text = readerCW1.GetValue(0).ToString()
'TextSupplier.Text = readerCW1.GetValue(1).ToString()
'TextQuantityPerUnit.Text = readerCW1.GetValue(2).ToString()
'TextUnitPrice.Text = readerCW1.GetValue(3).ToString()
'TextUnitsInStock.Text = readerCW1.GetValue(4).ToString()
'TextUnitsOnOrder.Text = readerCW1.GetValue(5).ToString()
'TextReorderLevel.Text = readerCW1.GetValue(6).ToString()
End If
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...
Re: Application Trust Level
an there's nothing wrong with the above code?
i'll drop them a message shortly
cheers mate
Re: Application Trust Level
Re: Application Trust Level
Quote:
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
Re: Application Trust Level
yeah just filling it in now, cheers man
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
Re: Application Trust Level
Re: Application Trust Level
Tried that lol
each time my ftp client says it was succesful but on refresh the file is still there
Re: Application Trust Level
just unlocked itself
i'll mark this as resolved now
cheers for your help mendhak