A simple and complex asp.net programming model

Source: Internet
Author: User
Asp.net| programming

Author: Tui (Richard Troy-rex, Ricktroy)
Contact: RickTroy@126.com, http://ricktroy.cnblogs.com/

Yesterday has been looking for a simple solution to the Ajax use in ASP.net V1.1.4322, but found that the ASP.net page model is very "weird." All the events and internal methods that it has, No one seems to be able to charge a solution but not refresh the page. That is, use the XMLHttpRequest on the page for HTTP GET, Page_Load event is not executed (because XMLHttpRequest responsetext is not Page_ Test results in the load code).

Later, you want to use HTMLControl, then use __doPostBack (eventtarget,eventargument), raisepostbackevent in script, but once the form is submitted, the page is refreshed ( It turned out to be the common sense of HTML forms, which had never really been studied before. However, even HTTP get XMLHttpRequest using HTMLControl does not solve the problem (Ibid. Page_Load event does not respond).

P.S: For server postback that want to imitate WebControl, you can use the client to write two hidden input, the name is __eventtarget and __eventargument, and then use the script __doPostBack ( control,argument); The syntax of the postback event is triggered.

Borrowed someone else's professional ASP. NET knows that in the ASP.net model you can use the IHttpHandler and IHttpModule two classes for HTTP request processing, but these two classes require precompilation, so even if you can write a response library its extensibility is not optimistic.

Please advise, is there any event and method can be directly in the page response and processing HTTP requests?
Or who can provide some form submit () method to pass data form,
Because XMLHttpRequest can send at the time of the request, if we know the form of submit submission data, it seems that we can go over the refresh submission data (but I have also considered this to be a security risk).
Please advise us.



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.