I added some AJAX code to an input form I was working on, everything was cool and it worked great. Click on the data grid link button, fill in the input form, no screen flicker.
When I put it to the Test environment and started running Watir against the web app in preparation for an update in Production (no -we're not automated here for unit testing - we are working on it though!)
I got this error when the Watir script ran against my new admin form:
"Sys.WebForms.PageRequestmanagerParserErrorException: the message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or servertrace is enabled."
I honestly thought no change had been made to the code, but a very large change was made which I didn't notice at first. The original tested code inherited from System.Web.UI.Page. That was a coding error because the entire application must use a base class - I plugged in the baseclass after testing and before putting it to the Test environment.
So, anyway, in the OnPreInit of the newly plugged in base class is code to set the expiration of the page. This is the code that was breaking my AJAX.
Response.Expires = 0;
Response.ExpiresAbsolute = DateTime.Now.AddMinutes(-1);
Response.AddHeader("pragma", "no-cache");
Response.AddHeader("cache-control", "private");
Response.CacheControl = "no-cache";
I added an override to OnPreInit to fix it. But that was an adventure to find.
So, my post for the week. Nothing going on here but LOTS OF PROGRAMMING ALL THE TIME. My Poor Garden!
//bcp 4/30/2007 if we make this inherit from BasePage class, we must override PreInit,
// because the AJAX doesn't work, Probably because
// the basepage sets the masterpage? heres the error: Sys.WebForms.PageRequestmanagerParserErrorException:
//the message received from the server could not be parsed. Common causes for this error
//are when the response is modified by calls to Response.Write(), response filters, HttpModules, or servertrace is enabled.
A conglomeration of subjects - I guess I'm just a scattered person.
Monday, April 30, 2007
Subscribe to:
Post Comments (Atom)
EZBurn Service Network Blog
FriendFeed badge
Subscribe
About Me
- Bobbi Perreault
- Glencoe, Minnesota, United States
- My online Resume I guess. All about Learning Internet and Programming technologies (especially Silverlight! ) Along with some personal tidbits - my paintings. Our Homemade House (every bit of it is homemade). I've worked as a programmer since 1992, first in DOS/Clipper. I earned my MCSE certification in 1999. Although I am somewhat of a Jack of all Trades (I guess) I try to specialize in eCommerce and Web Application development- With a whole lot of SQL Server.
No comments:
Post a Comment