|
-
Mar 16th, 2008, 07:35 PM
#1
Thread Starter
Addicted Member
[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
-
Mar 17th, 2008, 02:47 AM
#2
Fanatic Member
Re: Application Trust Level
Set the Trust level to FULL in your web.config.
vb Code:
<system.web>
<Trust Level= "Full" originUrl="" />
</system.web>
-
Mar 17th, 2008, 04:40 AM
#3
Re: Application Trust Level
Where are you getting this error - on your machine or your web host?
-
Mar 17th, 2008, 01:27 PM
#4
Thread Starter
Addicted Member
Re: Application Trust Level
on the server
gonna test the above now!
-
Mar 17th, 2008, 01:40 PM
#5
Thread Starter
Addicted Member
Re: Application Trust Level
 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:
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?
-
Mar 17th, 2008, 04:22 PM
#6
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.
-
Mar 17th, 2008, 05:04 PM
#7
Thread Starter
Addicted Member
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!
-
Mar 18th, 2008, 04:41 AM
#8
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.
-
Mar 18th, 2008, 04:03 PM
#9
Thread Starter
Addicted Member
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
-
Mar 18th, 2008, 04:26 PM
#10
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...
-
Mar 18th, 2008, 04:27 PM
#11
Thread Starter
Addicted Member
Re: Application Trust Level
an there's nothing wrong with the above code?
i'll drop them a message shortly
cheers mate
-
Mar 18th, 2008, 04:30 PM
#12
Thread Starter
Addicted Member
Re: Application Trust Level
-
Mar 18th, 2008, 04:31 PM
#13
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
-
Mar 18th, 2008, 04:32 PM
#14
Thread Starter
Addicted Member
Re: Application Trust Level
yeah just filling it in now, cheers man
-
Mar 18th, 2008, 05:01 PM
#15
Thread Starter
Addicted Member
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
-
Mar 18th, 2008, 05:02 PM
#16
Re: Application Trust Level
-
Mar 18th, 2008, 05:03 PM
#17
Thread Starter
Addicted Member
Re: Application Trust Level
Tried that lol
each time my ftp client says it was succesful but on refresh the file is still there
-
Mar 18th, 2008, 05:10 PM
#18
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|