ASP.NET communication from client to server

Can you help me understand all the methods of communication from browser to client in ASP.NET? I made this community a wiki, so feel free to edit my post to improve it. In particular, I'm trying to figure out which scenario to use in each, listing how each works.

I am a bit fuzzy in UpdatePanel vs CallBack (with ViewState): I know that UpdatePanel always returns HTML, while CallBack can return JSON. Any other significant differences?

... and CallBack (without ViewState) vs WebMethod. CallBack goes through most of the page life cycle, WebMethod does not. Any other significant differences?

IHttpHandler

  • Custom handler for anything (pages, images, etc.)
    • Performs only what you say ( light server processing, light traffic )
    • Page is an implementation of IHttpHandler
    • If You Don't Need a Page , Create a Custom IHttpHandler
    • If you use Page but override Render()and do not generate HTML, you can probably do this with IHttpHandler (for example, to write binary data such as images)
  • By default, you can use the .axd or .ashx extensions - both are functionally similar
    • .ashx has no built-in endpoints, so it prefers by convention

Regular PostBack ( System.Web.UI.Page : IHttpHandler )

UpdatePanel (System.Web.UI.Control)

CallBack (Page, System.Web.UI.ICallbackEventHandler)

WebMethod (System.Web.Service.WebService)

PageMethods

WCF

?

+3
2

WebMethod - ASMX, Microsoft " ". WCF. SOAP HTTP/HTTPS, REST JSON, .

PageMethods, .

+2

ICallbackEventHandler

  • ViewState ajax, , , ViewState ajax.
  • .
0

Source: https://habr.com/ru/post/1749462/


All Articles