1 / 12

Murano Software Inc .

Murano Software Inc. AJAX & ASP.NET Коренков Максим. Classic Web application. AJAX approach. AJAX approach benefits. Более быстрый отклик на действия Загрузка по требованию Уменьшается загрузка канала. AJAX & ASP.NET. Объект XmlHttpRequest ICallbackEventHandler ASP.NET AJAX.

esme
Download Presentation

Murano Software Inc .

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Murano Software Inc. AJAX & ASP.NET Коренков Максим

  2. Classic Web application

  3. AJAX approach

  4. AJAX approach benefits • Более быстрый отклик на действия • Загрузка по требованию • Уменьшается загрузка канала

  5. AJAX & ASP.NET • Объект XmlHttpRequest • ICallbackEventHandler • ASP.NET AJAX

  6. From scratch. XmlHttpRequest • IE 5.0 ActiveX “Microsoft.XmlHttp” • Other browsers native implementation • Частично формализован в “The DOM Level 3 Load and Save Specification”

  7. From scratch. XmlHttpRequest function createXMLHttpRequest() { var xmlHttp; if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } else { xmlHttp = null; } return xmlHttp; }

  8. From scratch. XmlHttpRequest function makeRequest() { createXMLHttpRequest(); xmlHttp.onreadystatechange = onAsyncResponse; xmlHttp.open("GET", “HandlePage.aspx", true); xmlHttp.send(null); } function onAsyncResponse() { if(xmlHttp.readyState == 4 && xmlHttp.status == 200) //complete && OK { alert("Response: " + xmlHttp.responseText); } }

  9. XmlHttpRequest problems Кэширование GET-запроса (напр., IE) • req.open( "GET", “mypage.aspx?rand=" + Math.random()); • C# Response Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetNoStore(); Response.Cache.SetNoServerCaching(); Response.Cache.SetExpires(DateTime.Now);

  10. ICallbackEventHandler • Обычная последовательность Page events • Возврат данных до Render

  11. ICallbackEventHandler public interface ICallbackEventHandler { string GetCallbackResult(); void RaiseCallbackEvent(string eArg); }

  12. ICallbackEventHandler problems • IE only

More Related