I have .net usercontrol and I show it in asp.net page as Object.
If the target framework of the usercontrol’s dll is 3.5 – everything works.
If I change it to .net 4.0 – the activex doesn’t visible.
The usercontrol is very simple. It’s just one button and one label:
[ComVisible(true)]
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
label1.Text = "0";
}
private void button1_Click(object sender, EventArgs e)
{
label1.Text = Convert.ToInt32(label1.Text) + 1 + "";
}
}
And this is the html code:
<object id="myControl2" name="myControl2"
classid="http:ClassLibrary1.dll#ClassLibrary1.UserControl1"
width="300" height="350" />
</asp:Content>
Why it’s not working?
I have been trying the same and found the following:
You can no longer host Windows Forms controls in the Internet Explorer, because there are better solutions for hosting controls on the Web. Therefore, the IEHost.dll and IEExec.exe assemblies have been removed from the .NET Framework.
from this article: http://msdn.microsoft.com/en-us/library/ee941656.aspx