JScript for the .NET Framework


How to implement IObjectSafety programmatically in JScript.NET


Consider this JScript.NET library (helloworld1.js):
package helloworld1{ class test1 { public function test1run(){ return 'This is a string returned from helloworld1.dll'; } }}
After running it throug:
jsc.exe /nologo /t:library helloworld1.js
and:
regasm /nologo /codebase helloworld1.dll
I can use it on my local html page with:
var helloworld1 = new ActiveXObject("helloworld1.test1");alert(helloworld1.test1run());
It works well but I get the usual "this is unsafe" warning from the browser:
An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction?
I know the way to remove the security warning is to mark the dll as safe for scripting and implement
IObjectSafety.
I know how to do this in VB6 and VB.NET but how do I go implementing it in JScript.NET?
Any help is greatly appreciated.
Hi Leo,
Thanks for the link. Yeah I figured out , as there is absolutely no documentation for IObjectSafety in JScript.NET, I can't implement this directly in the code.
Rather than going backward to C#, I finally settled down with adding the needed registry keys for marking my dll as "Safe for initialization" and "Safe for scripting":
[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}]
I add these keys during my setup routine, when helloworld1.dll is deployed on target machines. It works flawlessly.
Best wishes,
Hi tony,
If you write the library directly in JScript.NET, there is no approach to implement the IObjectSafety interface, because this COM interface is available in C# or C++ only.
You can rewrite your library in C# and implement the IObjectSafety interface via COM interop. Here is a wonderful tutorial for you:
http://www.dreamincode.net/forums/topic/38890-activex-with-c%23/.
Have a nice day, Leo Liu [MSFT]
MSDN Community Support | Feedback to us
Hi Leo,
Thanks for the link. Yeah I figured out , as there is absolutely no documentation for IObjectSafety in JScript.NET, I can't implement this directly in the code.
Rather than going backward to C#, I finally settled down with adding the needed registry keys for marking my dll as "Safe for initialization" and "Safe for scripting":
[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}]
I add these keys during my setup routine, when helloworld1.dll is deployed on target machines. It works flawlessly.
Best wishes,

Related Links

Error in AJAX PopUp Control Extender
JavaScript to Open Word 2010
Change td width dynamically
sql and javascript
Multiple nested Modal Popups
Drag and Drop Images from a Toolbox using javascript
Microsoft jScript runtime error
how to make a screen Like this?
Not Understand javascript code compatible with IE
how to find a texbox control inside a datagrid using javascript
ajax controls similar to office on web application
Create new HTML Helper for Search button
IE7 showmodaldialog displays unnecessary scroll bar with content
Javascript client server download speed help
Help i am getting this error 'Runtime error: unable to load dll jscript." can anybody help?
scrollbar in asp ListBox control

Categories

MSDN
Visual Studio Development
Windows Phone Development
Microsoft Office for D...
Visual Studio Design a...
Data Platform Development
Windows Embedded Compact
Samsung PC
Windows Hardware Devel...
Bing Maps
Archived Forums T-U
Archived Forums Visual...
Archived Forums W
Archived Forums
Skype for Business
Visual Basic
Visual C++
Visual Studio LightSwi...
Microsoft Message Queu...
Windows Desktop Optica...
Windows Desktop Pro-Au...
Windows Desktop Web Se...
Development with the W...
SharePoint 2013 - Search
SharePoint Legacy Vers...
SharePoint Legacy Vers...
Workflow Manager 1.0
Azure Networking (DNS,...
Azure Scripting and Co...
Azure DocumentDB
Azure Data Factory
Azure DevTest Labs
Azure IoT Hub
Azure Functions
Azure Data Lake Analyt...
Azure Blockchain
Publishing Apps for th...
Claims based access pl...
Visual Studio Visualiz...
Team Foundation Server...
Visual FoxPro General
Software Modeling Tools
Commerce Server 2009
XML, System.Xml, MSXML...
Reactive Extensions (Rx)
Debugger Canvas
Microsoft Live Labs Volta
Internet Explorer Exte...
Microsoft Translator H...
SyncFx - Microsoft Syn...
SyncFx – Microsoft Syn...
Microsoft Robotics - H...
Microsoft Device Emulator
SQL Server Tools
SQL Server Documentation
SQL Server Express
Microsoft Drivers for ...
SQL Server Master Data...
Standard 2009: Tools
Standard 7: Servicing ...
SQL Server 2012 Spatia...
Windows Forms Data Con...
Known Issues for Windo...
Microsoft Automatic Gr...
The Samsung Windows De...
Bing Maps for Windows ...
Open Specifications Qu...
SharePoint Server Prot...
Microsoft Unified Comm...
Getting Started with S...
Programming Silverligh...
Performance Profiling ...
MVVM / ViewModel Patte...
Silverlight for Window...
Expression Blend + Ske...
Windows Performance To...
Customer Care Framework
Surface Application De...
Microsoft Security Dev...
Retired SharePoint Acc...
Project Standard and P...
.NET Platform Architec...
Acropolis
Building Windows Store...
CAT.NET
Charts & Reports in th...
Core Coding Experience...
Dryad, DSC, and DryadL...
Dynamic Languages on .NET
Game Technologies: XNA...
Hobbyist Zone
Git, Mercurial and Dro...
LINQ to SQL (Pre-Release)
Microsoft ESP Platform...
Multimap API Developme...
Office Live Small Busi...
Pex and Moles PowerTool
Phoenix
NUI API and Programmin...
Search, Organize, and ...
Security for Azure
SQL Azure Labs Support
SQL Server 2014 Report...
SQL Server 2014 Master...
Team Foundation Server...
Tools for Windows Stor...
Visual Basic IDE
Visual C# Express 2008...
Visual Studio Team Ser...
Visual Studio Class De...
Visual Studio Team Sys...
Visual Studio Tools fo...
Visual Studio Web Perf...
WCF Data Services (Pre...
Web Gadget Development
Windows Presentation F...
Building Windows Store...
Ad Revenue, Payout & T...
Windows Phone Preview ...
Skype Web SDK

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile