ActiveX control Authoring Process Issues Summary

Source: Internet
Author: User

Microsoft JScript Runtime Error: Security Transparent method "MacActiveX.MacActive.GetComputerMAC ()" Attempt to access security critical method " System.Management.ManagementClass. ctor (System.String) "failed.

Assembly "Macactivex, version=1.0.0.0, culture=neutral, publickeytoken=null" marked AllowPartiallyTrustedCallersAttribute and use a Level 2 security transparency model. By default, Level 2 transparency causes all methods in the AllowPartiallyTrustedCallers assembly to become safe and transparent, which may be the cause of this exception.

Workaround: Add property settings to the class header: [System.Security.SecuritySafeCritical]

<object classid= "clsid:afea693d-7566-4f1e-b77c-80ccc2932296"
Codebase= "macactivexsetup.cab#version=1,0,0,0" id= "Hellobossma" ></object>

AssemblyInfo.cs Add the following

Using System.Security;

[Assembly:allowpartiallytrustedcallers ()]//Grant Trust rule statement
[Assembly:securityrules (SECURITYRULESET.LEVEL1)]//Add Transparency Rule Declaration

Reference Documentation:

Http://www.cnblogs.com/yilin/p/csharp-activex.html
Http://www.cnblogs.com/weixing/archive/2013/06/28/3161165.html
Http://www.cnblogs.com/shuang121/archive/2012/06/04/2534296.html
http://q.cnblogs.com/q/57913/
http://blog.csdn.net/ddllzz2008/article/details/5784737

ActiveX control Authoring Process Issues Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.