. Net2.0-winform combines the webbrowser control with the old socket technology to implement alternative push ~

Source: Internet
Author: User
Currently, enterprise-level development is popular with Web2.0 technology. However, because of the request-response interaction mode, many results cannot be effectively presented.
For example, in the push technology, many people feel a headache ~ How to make the server actively request the browser client ~ This technology is hard to solve by many ordinary developers (including me ~ Haha)
In fact, it is difficult to implement the push technology in enterprise-level development, but we need to understand the transformation method. If the technology is stuck in the research of push technology, it is a waste of time. Next I will talk about a "pseudo push" I made ":
I. Interaction between form and page Htmldocument htmldoc = Webbrowser1.document; // Obtain all the documents on the page of the webbrowser1 control.
Htmlelement btnelement = Htmldoc. All [ " Btnclose " ]; // Find the elements to interact with the form in the document

If (Btnelement ! =   Null )
{
Btnelement. Click + =   New Htmlelementeventhandler (htmlbtnclose_click ); // Add eventhandler (delegate name) to this element Click Event (the element is button)
}

Here is a simple example. The detailed version of this example is from a friend of the blog garden ~ Thanks ~~
Ii. Implement pseudo push
Now we can implement form and page interaction ~ So how to implement push?
In fact, the reason why I use form to host the page is here, some people may think I am in trouble ~ Why not use ajax to dynamically brush data? In this way, you can get real-time new data without refreshing new data, but constantly refreshing servers and communications will pose a great risk. I said that we are doing enterprise-level development, both stability and security should be taken into account, so I chose to use form to host web pages. In this case, workflow conversion and business operations on the business can be presented and executed using advanced Web technology, in addition, real-time data acquisition (staying on a page and getting new data from the server without refreshing) is not yet mature on the web, we can only rely on AJAX to actively request the server to implement the so-called push; this is obviously not as good as the old technology: socket is easy to use ~
Now, you should understand my ideas. It is to use the socket technology for information interaction, so that the server can specify a client to perform operations, and then implement a push effect through the form and page event interaction skills ~

First technology LaunchArticleI thought of this thing yesterday ~ It has never been used before.CommunityTo obtain some technical support. I have also done experiments to prove the feasibility of this idea ~ If you have any comments, leave a message to me ~

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.