[Huawei original] original sharing-implementation examples of Web instant applications with variable-length connections under Asp.net and demonstration of reverseajax

Source: Internet
Author: User

According to the company's recent training materials, the attachment includes a complete example of using a Web instant chat room with a variable length connection and a PPT training document for reverseajax, the PPT contains examples.Program.

Reverseajax invert Ajax is a Web Implementation Mode Designed to transfer logical control to the server.

What is Control Transfer

Traditional Ajax calls are generally triggered by client behavior, such as regional data acquisition and asynchronous verification.

Reverseajax transfers control to the server, just as the server triggers client events, that is, a very early web push technology.

ASP. NET requires the asynchronous page technology to implement a variable-length connection, and the session must be disabled for the page to generate a new instance for each request.

<% @ Page Language = "  C #  " Autoeventwireup = "  True  " Codefile = "  Response. aspx. CS " Inherits = "  _ Default  " Async = "  True  " Asynctimeout = "  30  " Enablesessionstate = "  False  " %>

If (Request. Form. Count>0 )
{
If (Request. Form [ " Type " ] = " Loop " )
{
Chattask = New Chattask ( This . Context );
Task. _ chatnow = This . Chatnow;// There is a new callback method for the message, that is, notification processing. At this time, the connection is released.
String User = request. Form [ " User " ]. Trim ();
Pageasynctask async = New Pageasynctask ( New Begineventhandler (task. onbegin ), New Endeventhandler (task. onend ), New Endeventhandler (task. ontimeout), user );
Page. registerasynctask (async );
Page. executeregisteredasynctasks (); // Asynchronous execution

}
}

DetailsCodeFor more information, see examples.

Attachment:

Presentation: reverseajax.pptx

Example program: reverseajaxchat .rar

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.