Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I display windows user controls inside IE8

I have a legacy windows form application, which I would like to be displayed insider users' browsers (IE8) like a web application. An approach that I have been looking at is to create a windows form library (dll) and to show that in the browser. There are many web pages that tell me how to do this:

  • http://msdn.microsoft.com/en-us/library/a7as3z1d(v=vs.90).aspx
  • http://forums.asp.net/t/1598007.aspx/1
  • http://windowsclient.net/articles/iesourcing.aspx
  • https://web.archive.org/web/20210619191631/https://www.4guysfromrolla.com/articles/052604-1.aspx
  • http://www.codeguru.com/csharp/.net/net_general/internet/article.php/c19639/Hosting-NET-Windows-Forms-Controls-in-IE.htm
  • http://weblogs.asp.net/spano/archive/2007/09/19/hosting-a-windows-form-control-in-a-web-page.aspx
  • http://codebetter.com/petervanooijen/2007/06/18/including-a-winforms-user-control-in-an-asp-net-web-page/

But I can't get it to work. I've made a simple windows control library, and built the DLL. I put that in the top level directory of an IIS 7.5 site, along with a html file like this:

<html>
   <body>
    <object id='c' classid='http:TestWinCtrlLib.dll#TestWinCtrlLib.UserControl1' height='300' width='400'>
    </object>
  </body>
</html>

My browser shows a 300x400 box with a small 'picture' icon in the top left. At first, IIS refused to serve the .dll file giving 403.2 and 401.2 errors, but now I've set the IIS persmission properties correctly, the logs indicate that it is being served successfully.

2012-05-01 01:28:50 ::1 GET /form.html - 8008 - ::1 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+.NET4.0C;+.NET4.0E) 200 0 0 1
2012-05-01 01:28:50 ::1 GET /TestWinCtrlLib.dll - 8008 - ::1 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+.NET4.0C;+.NET4.0E) 200 0 0 23

I can't even tell what is going wrong. The first link above has a section on error reporting, and I've added these keys to the registry, but I don't see any errors. I tried starting iexplore from a cmd prompt, in case errors might show up on the standard output, but nothing.

Error Reporting

The code download process uses the following two registry settings to control error reporting from managed code executables that are deployed using Internet Explorer.

  • HKLM\Software\Microsoft.NETFramework\ExposeExceptionsInCOM
  • HKCU\Software\Microsoft.NETFramework\ExposeExceptionsInCOM

...

When you debug managed code that you deploy using Internet Explorer, you can use the values of these settings to find detailed information about code download failures. For example, this allows you to view stack trace information when exceptions are thrown, instead of relying on the error-reporting provided by Internet Explorer, which was designed for end-users, not developers.

Is it possible that this functionality is no longer supported? Most of the references I found seem to be 2007-2010. Perhaps ClickOnce is the only way to do this now. I can get that to work, but the code runs in its own window, not inside the browser.

I've tried compiling the library using .Net frameworks 3.5 Client Profile and 4.0 Client Profile. But they seem to give the same result.

Any help welcome - thanks.

like image 983
John Avatar asked Nov 13 '22 06:11

John


1 Answers

You might consider using Remote Desktop Services for this instead. It works over ActiveX so only Internet Explorer is supported (although there are 3rd party solutions that enable you to access RDS over non IE browsers or mobile phones).

For the guides and documentation go to: http://technet.microsoft.com/en-us/library/dd647502(v=ws.10)

like image 82
Vedran Avatar answered Dec 14 '22 23:12

Vedran