From: Argiris K. <be...@us...> - 2005-12-20 23:51:48
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6985/Core Modified Files: AjaxCallHelper.cs MagicAjaxModule.cs PageFilter.cs Log Message: There were conflicts with other HttpModules when they modified cookies; to fix it: --Removed all Response.Flush method calls --Moved the handling of the html page (i.e. retrieving the viewstate) at the Application_EndRequest method Index: PageFilter.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/PageFilter.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PageFilter.cs 20 Dec 2005 22:48:12 -0000 1.7 --- PageFilter.cs 20 Dec 2005 23:51:40 -0000 1.8 *************** *** 35,38 **** --- 35,39 ---- private Stream _responseStream; private Stream _memStream; + private MagicAjaxContext _magicAjaxContext; public PageFilter(Stream _responseStream) *************** *** 40,43 **** --- 41,45 ---- this._responseStream = _responseStream; this._memStream = new MemoryStream(); + this._magicAjaxContext = MagicAjaxContext.Current; } *************** *** 181,190 **** public override void Write(byte[] buffer, int offset, int count) { ! if (MagicAjaxContext.Current.IsAjaxCall) { ! _memStream.Write(buffer, offset, count); ! ! if (MagicAjaxContext.Current.CompletedAjaxCall) _responseStream.Write(buffer, offset, count); } else --- 183,192 ---- public override void Write(byte[] buffer, int offset, int count) { ! if (_magicAjaxContext.IsAjaxCall) { ! if (_magicAjaxContext.CompletedAjaxCall) _responseStream.Write(buffer, offset, count); + else + _memStream.Write(buffer, offset, count); } else Index: AjaxCallHelper.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/AjaxCallHelper.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AjaxCallHelper.cs 20 Dec 2005 13:11:07 -0000 1.15 --- AjaxCallHelper.cs 20 Dec 2005 23:51:40 -0000 1.16 *************** *** 430,435 **** MagicAjaxContext.Current.CompletedAjaxCall = true; - - hr.Flush(); hr.End(); } --- 430,433 ---- Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxModule.cs,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** MagicAjaxModule.cs 20 Dec 2005 22:48:12 -0000 1.44 --- MagicAjaxModule.cs 20 Dec 2005 23:51:40 -0000 1.45 *************** *** 55,58 **** --- 55,59 ---- { private bool _threadAbortExceptionThrown; + private bool _processedAjaxCall; private PageFilter _filter; private HttpRequest _request; *************** *** 420,423 **** --- 421,425 ---- // Init private fields _threadAbortExceptionThrown = false; + _processedAjaxCall = false; _request = context.Request; _response = context.Response; *************** *** 543,575 **** } #endif ! ! _response.Flush(); ! ! if ( ! viewStateIsExcluded ) ! { ! string vsValue = _filter.GetViewStateFieldValue(); ! if (vsValue != null && _request.Form["__VIEWSTATE"] != vsValue) ! { ! AjaxCallHelper.WriteSetFieldScript("__VIEWSTATE", vsValue); ! } ! } ! ! #if NET_2_0 ! // Check if this request is to add/remove/replace a WebPart ! // If so, send back updated WebPartManager drag&drop javascript (IE only) ! if (!string.IsNullOrEmpty(_request.Form["__WPPS"])) ! { ! string wpmValue = _filter.GetWebPartManagerScriptValue(requestPage.Form.ClientID); ! if (wpmValue != null) ! { ! // Send script to cleanup current clientside WebPartManager object ! AjaxCallHelper.Write("if (typeof(WebPartManager_Cleanup) == 'function') { WebPartManager_Cleanup(); }"); ! ! // Send script to setup webpartmanager drag&drop + webpartmenu's ! AjaxCallHelper.Write(wpmValue); ! } ! } ! #endif ! AjaxCallHelper.End(); } } --- 545,550 ---- } #endif ! _processedAjaxCall = true; ! _response.End(); } } *************** *** 643,647 **** } ! AjaxCallHelper.End(); } } --- 618,623 ---- } ! _processedAjaxCall = true; ! _response.End(); } } *************** *** 662,680 **** try { ! if (_magicAjaxContext.IsAjaxCall && !_magicAjaxContext.CompletedAjaxCall && _threadAbortExceptionThrown) { ! // There was a Response.Redirect or Server.Transfer during AjaxCall ! ! if (_response.RedirectLocation != null) { ! // Handle Response.Redirect ! AjaxCallHelper.Redirect (_response.RedirectLocation); } ! else { ! // Handle Server.Transfer ! AjaxCallHelper.Init(); ! if (_filter != null) { string html = _filter.GetHtmlPage(); if (_request.Browser != null && _request.Browser.Browser == "IE") --- 638,689 ---- try { ! if ( _magicAjaxContext.IsAjaxCall ) { ! if ( _processedAjaxCall ) { ! // If the ViewState wasn't excluded from the post data, retrieve ! // it and send it to client. ! if ( _magicAjaxContext.IsPageNoStoreMode && _request.Form["__VIEWSTATE"] != null ) ! { ! string vsValue = _filter.GetViewStateFieldValue(); ! if (vsValue != null && _request.Form["__VIEWSTATE"] != vsValue) ! { ! AjaxCallHelper.WriteSetFieldScript("__VIEWSTATE", vsValue); ! } ! } ! ! #if NET_2_0 ! // Check if this request is to add/remove/replace a WebPart ! // If so, send back updated WebPartManager drag&drop javascript (IE only) ! if (!string.IsNullOrEmpty(_request.Form["__WPPS"])) ! { ! string wpmValue = _filter.GetWebPartManagerScriptValue(requestPage.Form.ClientID); ! if (wpmValue != null) ! { ! // Send script to cleanup current clientside WebPartManager object ! AjaxCallHelper.Write("if (typeof(WebPartManager_Cleanup) == 'function') { WebPartManager_Cleanup(); }"); ! ! // Send script to setup webpartmanager drag&drop + webpartmenu's ! AjaxCallHelper.Write(wpmValue); ! } ! } ! #endif ! ! AjaxCallHelper.End(); ! } ! else if ( _threadAbortExceptionThrown && !_magicAjaxContext.CompletedAjaxCall ) { ! // There was a Response.Redirect or Server.Transfer during AjaxCall ! ! if (_response.RedirectLocation != null) ! { ! // Handle Response.Redirect ! AjaxCallHelper.Redirect (_response.RedirectLocation); ! } ! else { + // Handle Server.Transfer + AjaxCallHelper.Init(); string html = _filter.GetHtmlPage(); if (_request.Browser != null && _request.Browser.Browser == "IE") *************** *** 688,693 **** } AjaxCallHelper.WriteSetHtmlOfPageScript(html); } - AjaxCallHelper.End(); } } --- 697,703 ---- } AjaxCallHelper.WriteSetHtmlOfPageScript(html); + + AjaxCallHelper.End(); } } } |