The application attempted to perform an operation not allowed by the security policy

Posted on 2006-04-26
Last Modified: 2011-08-18
I am having an issue where if I use "SendKeys.Send() function", I receive a security error.  I have tried working around this in the Administrator Tools in the Control Panel, but the issue persists.

The error received is:

"The application attempted to perform an operation not allowed by the security policy. The operation required the SecurityException. To grant this application the permission please contact your system administrator, or use the Microsoft .NET security policy administration tool.

Unable to create Hook."

Any ideas how to resolve the error?
Question by:Negafox
    LVL 12

    Expert Comment

    as a quick test.. go to configuration wizard for net 1.1

    go to Runtime security policy

    select adjust zone security

    makes changes for the computer

    set my computer to full trust

    NEXT then FINISH and try app again


    Author Comment

    Unfortunately, I already tried that in the previously and it did not resolve the issue.  I tried it again though and the same issue persists:

    -Opened Control Panel
    -Opened Administrative Tools
    -Opened Microsoft .NET Framework 1.1 Wizards
    -Clicked Adjust .NET Security
    -Selected My Computer
    -Trust is already set to "Full Trust" on the slidebar
    -Selected Local Intranet
    -Trust is already set to "Full Trust" on the slidebar
    -Clicked Next
    -Clicked Finished

    Author Comment

    If the information would be useful, I am developing this application on a work computer.  However, I have Administrative access in case there is something that may need to be changed.
    LVL 1

    Expert Comment

    Hi Negafox,

    Can you tell me a little more detail about the code you are writing.


    Author Comment

    1. Create a new application in C#.
    2. Drop a button onto the form.
    3. Double-click the button to open the onClick() event.
    4. Type "SendKeys.Send("{A}");" and compile.

    Even this yields the exact same error on my work computer.  However, it works fine on my home computer.

    Author Comment

    The issue is resolved now. It turns out that Cisco Security Agent was running in the background. I had the system administrator disable the program and it resolved the issue.
    LVL 12

    Expert Comment

    Thank you for the update, Negafox.  I could only find one or two references to this problem and appreciate the extra details and feedback you gave us here.

    Accepted Solution

    PAQed with points refunded (500)

    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now