问题
Is there a pure .NET replacement for ActiveX? I'm asking if there is a way for me to write a thick client side control to be loaded and interacted with in a web page in .NET, with NO com.
Edit: I don't want ActiveX in pure .NET, I want a .NET alternative to ActiveX.
回答1:
I'm afraid there is no perfect managed only equivalent of ActiveX. Mostly for good reason. ActiveX is a dangerous technology security wise and duplicating it's effects in many ways would require duplicating the lack of security.
Have you tried SilverLight?
It's not a perfect ActiveX replacement because it doesn't grant you unferreted access to the machine. But it does provide the ability to write rich client side controls in .Net.
回答2:
You can use UserControl it can be embedded inside IE, I don't know what you mean by interaction with the web browser, but it can call out scripts on the page and post events that can be handled by scripts on the page.
Notice that .NET must be preinstalled in order for the control to work.
You can also go with Silverlight as JaredPar mention, but then your api is more limited.
来源:https://stackoverflow.com/questions/748603/net-activex-equivalent