No More Solutions

You can find a lot of debugging and deploying problems while developing applications in .NET and Visual Basic here. There are also some querying tips in SQL and typical source codes which might be useful shared here.

Running ActiveXObject from Javascript

Problem: Can't run ActiveXObject from Javascript
Error: System.Security.Permissions.SecurityPermission

This error occurs when you are trying to run ActiveXObject / dll using Javascript.


Solution:
A. Setting the security for the internet browser, i.e. Internet Explorer
1. Using Internet Explorer, set the security to low: Goto menu Tools -> Internet Options.
2. Goto tab Security.
* Under Internet zone, set security level to Low. Click Custom level button, in ActiveX controls and plug-ins section, Enable Script ActiveX controls marked safe for scripting*, then click OK.



* Under Local intranet zone, click Custom level button, enable things under ActiveX controls and plug-ins section, and the most important one, Enable Script ActiveX controls marked safe for scripting*, then click OK.



B. Setting .Net Framework 2 Configuration
1. Make sure you have .Net Framework 2 SDK installed on your computer. You may want to install it if you have not had it installed on your computer.
2. Goto control panel -> Administrative Tools -> open Microsoft .NET Framework 2.0 Configuration.
3. On the Tasks, click Configure Code Access Security Policy -> Adjust Zone Security -> Make changes to this computer, and Next. Set My computer & Local Intranet to Full trust, then Next -> Finish.




Restart the Internet Explorer, then try running the Web page again.

PS: While it is not recommended to run untrusted ActiveX Object, because it may cause security leak; this is a workaround to solve the problem in case it is necessary to run the ActiveX Object on client side.
Bookmark and Share

0 comments:

Post a Comment