Partager via


Update for the iPhone Update

After installing the iPhone 1.01 software update, iPhone users may notice that what used to be an asynchronous request from the browser is now a syncrhonous request. They may notice other symptoms of an underlying problems as well. The update changes the way regular expressions are processed by the Safari browser and adversely affects a regular expression used by the Microsoft AJAX Library for JSON serialization. An updated regular expression preserves the functionality and works with the new Safari behavior. The regular expression is in a script file served from the System.Web.Extensions.dll on the server by default. Here are the set of steps you can take to have the scripts served from the file system instead with an updated version compatible with the iPhone change.

Download the Microsoft AJAX Library scripts from https://asp.net/ajax/downloads/library/default.aspx . Open the zip file and copy the contents of the System.Web.Extensions folder into a directory of your application, let's call it Scripts for now.

Change the ScriptReference instances of your AJAX pages to to include a ScriptPath attribute that refers to the directory where you have copied the scripts.
<asp:ScriptManager ScriptPath="~/Scripts] " />

Update the debug and release scripts. In MicrosoftAjax.debug.js, find this:
Sys.Serialization.JavaScriptSerializer._stringRegEx = new RegExp('["\b\f\n\r\t\\\\\x00-\x1F]', 'i');

and replace it with this:
Sys.Serialization.JavaScriptSerializer._stringRegEx = new RegExp('["\\b\\f\\n\\r\\t\\\\\\x00-\\x1F]', 'i');

In the release version of the script, you are updating the same RegExp, but it is a little trickier because the whitespace has been stripped from the file, so be particularly careful to leave the surrounding code untouched:

 

...ScriptSerializer");Sys.Serialization.JavaScriptSerializer._stringRegEx=new RegExp('["\\b\\f\\n\\r\\t\\\\\\x00-\\x1f]',"i");Sys.Serialization...

Known Issue:

The .zip file does not include localized copies of the scripts. If you enable Script Localization on the ScriptManager, it will generate requests for localized versions of the scripts and will now be looking for them on disk. The workaround is to rename the script files to MicrosoftAjax.en.js and MicrosoftAjax.debug.en.js and add ResourceUICultures="en" to the ScriptReference. You do not need to modify the path or name.

Comments

  • Anonymous
    September 11, 2007
    Matt Gibbs recently posted about an update to the ASP.NET AJAX Script library that fixes functionality

  • Anonymous
    September 11, 2007
    See: http://blogs.msdn.com/mattgi/archive/2007/09/11/update-for-the-iphone-update.aspx

  • Anonymous
    September 16, 2007
    The comment has been removed

  • Anonymous
    September 18, 2007
    The comment has been removed

  • Anonymous
    October 03, 2007
    The comment has been removed

  • Anonymous
    October 04, 2007
    Matt Gibbs blogs about update to ASP.NET Ajax to fix issues with iPhone Safari which has been updated

  • Anonymous
    February 27, 2008
    September 16th Links: ASP.NET, ASP.NET AJAX, IIS7, Visual Studio, Silverlight