VC Write ActiveX control can be asp.net reference

Source: Internet
Author: User
Tags client
Active|activex|asp.net| Control

1. Dear Partner: Hello!
Thank you very much for using Microsoft Newsgroup Technical support!
About the asp.net you mentioned that the VC can not write the control of the problem, I would like to ask you to refer to the server side of the VC control some of the features, or VC wrote an ActiveX control and can not be used in the Web page. Could you please describe in detail the errors you are experiencing. Or you are referring to the VC control the specific error message encountered, so that we can better to help you solve the problem, thank you!

2. With regard to your reference to the interaction of C # with the ActiveX control written by VC, from your description, I understand that you want to know how the ASP.net server communicates with the ActiveX controls contained in the foreground page, if my understanding is incorrect, please point out.
In my experience, there is no way for the background program to communicate directly with the foreground ActiveX because they are under two different mechanisms. First of all, ActiveX behavior or events are started on the client, and it does not have the ability to communicate with the server side. Second, C # written asp.net completely belongs to a set of Web application framework system, it itself corresponding to the client's request, and then make some specific response action, and it does not have the ability to capture client events. So there's no way to get ActiveX controls to communicate directly with ASP.net server-side applications.
Therefore, according to my experience, we can choose two ways to achieve. First, we can write some hidden fields to store some of the information that ActiveX changes on the client. For example, in the case of ActiveX controls, where the user chooses to change from "Beijing" to "Shanghai", we can use JavaScript to capture this event (the specific capture method depends on the actual implementation of the ActiveX control), We use JavaScript to change the information about some of the hidden fields that we have set up, and then, when the postback events are fired by some server-side controls, they are passed to the server side and stored in the database by the server. Accordingly, when the server segment reads some information from the database and then renders it in some of the hidden fields of the client, the ActiveX control then retrieves the information from the field.
Another approach is that we need to write our own HttpListener, listen for HTTP requests, and then make judgments, and if it is an ActiveX request, notify the current ASP.net application to respond to the request.

Hope my reply is helpful to you, thank you!

3. About you mentioned "friend to me that C # can implement VC ActiveX control Interface or abstract class", I would like to ask you here refers to the server side or client. First, if on the server side, then. NET and ActiveX can interoperate through COM interop. Just as we want to read data from the database on the server side, and there are some customization requirements, this time we can write an ActiveX in C + + to implement this function, and then call this ActiveX in the ASP.net application to read the data out. But as I mentioned earlier, this is a purely server-side behavior.
And from your current needs, the Web page must contain an ActiveX control that was downloaded and installed by the client, at which point the client opened the browser to access the Web page, interacting with the server-side data directly from the ActiveX controls in the Web page. There is no way for asp.net to capture these events at this time unless you use JavaScript capture and then communicate with ASP.net.
According to my experience, your friend may be referring to the first kind of interactive behavior.




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.