如何将JScript.NET dll标记为脚本安全?
考虑一下这个JScript.NET库(helloworld1.js)
package helloworld1{
class test1 {
public function test1run(){
return 'This is a string returned from helloworld1.dll';
}
}
}在经历了之后
jsc.exe /nologo /t:library helloworld1.js
和
regasm /nologo /codebase helloworld1.dll
我可以在本地html页面上使用它:
var helloworld1 = new ActiveXObject("helloworld1.test1");
alert(helloworld1.test1run());这一切都很好,我在This is a string returned from helloworld1.dll上得到了一个警告。
现在..。我想消除每次ActiveX对象实例化时都会弹出的可怕的IE安全警告。
An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction?
我知道删除安全警告的方法是将dll标记为safe for scripting并实现IObjectSafety。
我知道如何在VB6和VB.NET中实现它,但是如何在JScript.NET?中实现它呢?
任何帮助都是非常感谢的。
发布于 2011-12-28 22:03:15
经过广泛的研究,我发现,由于IObjectSafety在JScript.NET中绝对没有文档,所以我无法在代码中直接实现这个接口。
最后,我决定添加必要的注册表项,将我的dll标记为“初始化安全”和“脚本安全”:
[HKEY_CLASSES_ROOT\CLSID\[MY_COM_CLASS_GUID]\Implemented Categories\{7DD95801-9882-11CF-9FA9-00AA006C42C4}]
[HKEY_CLASSES_ROOT\CLSID\[MY_COM_CLASS_GUID]\Implemented Categories\{7DD95802-9882-11CF-9FA9-00AA006C42C4}]当helloworld1.dll部署在目标计算机上时,我在安装例程中添加这些键。它运行得完美无缺。
https://stackoverflow.com/questions/8621232
复制相似问题