ASP Programming Question:
Download Questions PDF

How do I make it so that code runs when the security system is stopping it?

Answer:

Security exceptions occur when code attempts to perform actions for which it has not been granted permission. Permissions are granted based on What is known about code; especially its location. For example, code run from the Internet is given fewer permissions than that run from the local machine because experience has proven that it is generally less reliable. So, to allow code to run that is failing due to security exceptions, you must increase the permissions granted to it. One simple way to do so is to move the code to a more trusted location (such as the local file system). But this won't work in all cases (web applications are a good example, and intranet applications on a corporate network are another). So, instead of changing the code's location, you can also change security policy to grant more permissions to that location. This is done using either the .NET Framework Configuration tool or the code access security policy utility (caspol.exe). If you are the code's developer or publisher, you may also digitally sign it and then modify security policy to grant more permissions to code bearing that signature. When taking any of these actions, however, remember that code is given fewer permissions because it is not from an identifiably trustworthy source—before you move code to your local machine or change security policy, you should be sure that you trust the code to not perform malicious or damaging actions.

Download ASP Programming Interview Questions And Answers PDF

Previous QuestionNext Question
Why does my code get a security exception when I run it from a network shared drive?How do I administer security for my machine? For an enterprise?