Use Windows Forms control in IE

Source: Internet
Author: User
Tags net command net command line

According to the needs of the online monitoring project, it is necessary to be realistic to run the smartclient program in IE, and to be able to interact with the client's JavaScript.

The. net sdk documentation contains the following descriptions:

  • The Windows Form Control in IE can be activated without a user prompt. It does not require registration and complies with the access security rules of the Common Language Runtime Library (CLR) code;
  • Almost any windows form control can be carried in IE. The control must be installed in the Global Assembly Cache (GAC) or be located in the same virtual directory as the web page using it;
  • The execution permission of the IIS virtual directory must be a pure script; otherwise, the control to be used cannot be activated.

To run the Windows Forms control in IE, follow these steps:

  1. Create a Windows Form Control:
    Create a Windows control library project, which is the same as a common control library.
  2. Create HTML document that references the Windows Form Control:
    Add the object tag to the HTML document, which references Windows Forms controls such:
    <Object ID = "smartclient1" classid = "http: clientlib/smartclientlib. dll # smartclientlib. usercontrol1"
    Width = "300" Height = "300">
    <Param name = "text" value = "simple control">
    </Object>
    The most important thing is the classid, which includes the relative path to the control library and the fully qualified name of the control. Unlike the ActiveX Object Tag, The GUID is not required for Windows form controls, in Windows Forms controls, paths and fully qualified class names are used as unique identifiers. You can also use Param tags to set properties on the control. name indicates the name of the property and value indicates the value of the property; you can also use JavaScript scripts to access public properties and methods of controls.
  3. Create a virtual directory and Set permissions:
    As described above, set the permissions for the virtual directory where the web page is located and deploy the Windows Forms control.
  4. Run the control:
    Start ie web browsing. Windows Forms can only run in IE browser, but cannot run in other browsers.

NOTE: If vs2005 is used for compilation, the form control cannot be normally displayed, or cannot interact with the client Javascript script. Copy all the windows form control code to a file and use it. net command line tool CSC/vbc for compilation, it can be displayed normally, I do not know what is going on.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.