How can I solve this connection error ?

I get problem with the following error and I don't know how to solve it.
Please tell me about that if you know.
Thank you very much !
=====================

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: Requested registry access is not allowed.

Source Error:

Line 147: // oleDbConnection1 Line 148: // Line 149: this.oleDbConnection1.ConnectionString = "Provider=MSDAORA.1;Password=vptpm;User ID=tpm;Data Source=yybond2003"; Line 150: // Line 151: // dataSet11



Answer this question

How can I solve this connection error ?

  • Truc Nguyen

    you've put it in the wrong file (that looks like the machine.config rather than the web.config). If you're altering machine.config, search for "<trust level=" and set it to Full.

    Please note, this is a c# forum, for asp.net questions please use the asp.net forums

    Cathal

  • Bob - GP

    That is a code access security (CAS) error. When you try to use an oledb source in 1.1, your application needs full trust CAS (in 2.0 this condition has been relaxed). If you're using asp.net then you can set this in your web.config by adding a node such as "<trust level="Medium"  />" into your system.web section (note: you will probably need to recycle either your application pool or your webserver [eg. via IISRESET] to get the application to pick up it's new security context). This setting may not be effective as it can be set in the machine.config of the server, and marked as being not-overridable.

    If you're getting this error in a windows form application, you will have to ensure that the user has sufficent permissions to operate in fulltrust.

    Cathal


  • shaney

    I tried do that as your direction but I get this error. What should I do now.
    I wonder that my Web Page run normally before but today I don't know why it get that error. Can you give me an explain about that Maybe I modified something on my computer yesterday. Because I didn't open my Web source for anything.

    I would like to thank for your help. I hope I'll get your reply as soon as possible.
    And this is new error in Config.web :

    Configuration Error
    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: Unable to read the security policy file for trust level 'Medium'.

    Source Error:
    Line 29:     </assemblies>
    Line 30:     </compilation>
    Line 31:     <trust level="Medium"/>
    Line 32:     <!--  CUSTOM ERROR MESSAGES
    Line 33:           Set customError mode values to control the display of user-friendly



  • How can I solve this connection error ?