Steps for embedding a windows forms user control in web page

霸气de小男生 提交于 2019-12-30 12:36:32

问题


I am developing a windows forms user control in Visual Studio 2005. It is a file upload control and uses only 2 elements.

  1. A button for showing opnefiledialog
  2. An openfiledialog

I have added an object tag to the html page with the class id and all that.

<OBJECT id="myControl1" name="myControl1" classid="ActiveXUploadFile.dll#ActiveXUploadFile.FileUpload" width=288 height=300></OBJECT>

The namespace is ActiveXUploadFile and class name is FileUpload.

But the control is not displayed in the web page.

Is there anything more to be done for this?

Thanks


回答1:


Windows Forms and html really don't mix that well. Why don't you just use the asp control? Just add it to your aspx page like so:

<asp:FileUpload ID="FileUpload1" runat="server" />

Matthew




回答2:


For doing this, the users will have to have .NET framework installed on their machines (most of the users have it). Then to view the control, they will have set the .NET security policies.

I had once used Atalasoft's .NET component for ASP.NET, and it required performing the settings given on this page.

You can try creating a normal COM ActiveX in .NET instead of a .NET web component. This way you'll only have to digitally sign it and the users will have to permit the control to be installed on their machine.




回答3:


Provide the complete url for the classid attribute

ex: classid="http://localhost/FirstServiceTestForm.dll#TestForm.myControl"



来源:https://stackoverflow.com/questions/1270079/steps-for-embedding-a-windows-forms-user-control-in-web-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!