I have a web page that calls a .Net assembly. Everything works fine in Windows XP and IE7. The relevant parts:
<html>
<head>
<script language="javascript" type="text/javascript">
function doScript() {
myControl1.Go("value1","value2");
}
</script>
</head>
<body onload="javascript:doScript();">
<object id="myControl1" name="myControl1"
codebase="../cabs/myassembly.dll"
classid="../cabs/myassembly.dll#MyNs.MyClass"
width="1" height="1"></object>
</body>
</html>
I cannot get this to work in Windows 7 with IE8. Some notes:
- The assembly is strong named.
- I am hosting this on
localhost
right now.- On the machine that is working (VirtualBox-hosted WinXP, IE7), it is using an IP address to my local machine (
http://1.2.3.4/...
) and that IP is in the "Trusted Sites" of IE. - On the machine that is not working (Windows 7, IE8), it is using
http://localhost/...
andlocalhost
is in the "Trusted Sites" of IE.
- On the machine that is working (VirtualBox-hosted WinXP, IE7), it is using an IP address to my local machine (
- The assembly is being served from
http://localhost/cabs/myassembly.dll
. - The error message is a javascript error, "Object doesn't support this property or method"
- Fiddler shows a 200 OK response when the file is requested, however, it does not appear that the dll is making it to the temporary internet files location.
- The site is running in "IE 7 compatibility" mode.
- I have dropped all IE permissions to the most insecure it will let you in all zones, and the behavior is exactly the same.
Does anyone have any ideas to try to get this to work or troubleshoot where the problem is at?
Disclaimer: Yes, I realize it is 2012, and the world has moved past IE7, IE8, ActiveX, etc. Let's just say we're a little bit behind technologically. This is the problem I have to solve; upgrading to modern solutions isn't going to be an option.
UPDATE: I did get it to work in a Windows XP VirtualBox running IE8. So it appears the problem is specific to Windows 7. It fails both on my local machine and a VirtualBox running Windows 7, IE8.
This was solved by adding the registry key answered on "Loading .NET UserControls in IE with .NET 4.0" (even though this was a 2.0 control)
Don't use .dll file. Use .cab instead.
I'm not sure that this will help, but I have had a similar issue and this has usually fixed it. Try these steps on the machine where it's not working.
Trusted sites
zone.Security
tab inInternet Options
and clickTrusted sites
Default level
and make sure that it selectsMedium
. If not, manually set it toMedium
.For good measure, close all IE windows and then relaunch and test if it works.
The key issue is the one that was discussed in the page that rene linked to in his second comment. As of IE8 and onwards, there is a security setting that does not have it's own UI in the
Custom level
list of options. The only way to affect it is by setting theLevel
-Medium
or lower sets it toEnable
whileMedium-high
higher sets it toDisable
.Now this might very well not be your problem, since usually the default level for
Trusted sites
is Medium which would enable the setting. But it's worth trying at least (maybe you have some Group Policy or something that has changed the default level of Trusted Sites).