问题
I am developing a windows forms user control in Visual Studio 2005. It is a file upload control and uses only 2 elements.
- A button for showing opnefiledialog
- 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