0
votes

I am trying to use random access data file in ASP.NET. "rd4" is my application name. It works well in localhost, but it showed the following error message. Setting the read/write permission at the server does not help. Any suggestions will be appreciated.

Attempt by security transparent method 'rd4._default.Button1_Click(System.Object, System.EventArgs)' to access security critical method 'Microsoft.VisualBasic.FileSystem.FileOpen(Int32, System.String, Microsoft.VisualBasic.OpenMode, Microsoft.VisualBasic.OpenAccess, Microsoft.VisualBasic.OpenShare, Int32)' failed.

Assembly 'rd4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is partially trusted, which causes the CLR to make it entirely security transparent regardless of any transparency annotations in the assembly itself. In order to access security critical code, this assembly must be fully trusted.

1
This doesn't mean you can't use a random access file. It means you can't use Microsoft.VisualBasic.FileSystem.FileOpen to do it, unless your admin makes the assembly fully trusted. - John Saunders
Is it possible to control the trust level through the web.config file? - user1617676
I should know, but I don't. I've never had to play with trust level in ASP.NET. - John Saunders
I have found a solution of using web.config file as follows. Thanks a lot, John. - user1617676

1 Answers

2
votes

I have found the solution as follows:

Add the following tag to my web.config:

<configuration>
    <system.web>
        <trust level="Full" />
    </system.web>
</configuration>