Wednesday, March 21, 2012

ASP .NET AJAX Error in MOSS 2007

After installing the release candidate for ASP .NET AJAX on MOSS 2007 RTM (Windows Server 2003 sp1), I get the following error on a web part page that contains a web part hosting a very simple user control (markup at end of this post):

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 Respons.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near 'Box1"/>
|Welcome Jim Ohearn<s'.

The error happens only once when I either click on the button or enter text in the text box. By the way, the web part page becomes uneditable at this point and the onClick call back on the button doesn't punch text into the text box.

I modified the web.config file for SharePoint using the example web.config file that is downloaded with the ASP .NET AJAX toolkit. HTTP commands that used to be handled by SharePoint are now handled by the System.Web.Extensions DLL. Could this be the source of the problem? I've included what I think are the critical changes I've made to the web.config file at the end of this post.

Here is a related posting:
http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=898318&SiteID=17

Here, the person making the post accuses a component in the SharePoint page of executing the Response.Write().

If anyone has any ideas, I'd really appreciate it.

Thanks.

Jim

User control markup:

<%@dotnet.itags.org. Control Language="C#" %
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
<script runat="server"
public void handleOnClick(object sender, EventArgs e)
{
this.TextBox1.Text = "Button Pressed";
}
</script
<div id="wcContent" style="height:300px;width:400px">
<asp:Panel runat="server" id="wc_Div" style="position: relative; top: 10PX; left: 6PX;" >
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="conditional" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" OnClick="handleOnClick" runat="server" Text="Button" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
</div
web.config snippet:

<remove verb="*" path="*.asmx"/>
<remove verb="GET,HEAD,POST" path="*" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
<add verb="GET,HEAD,POST" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add verb="OPTIONS,PROPFIND,PUT,LOCK,UNLOCK,MOVE,COPY,GETLIB,PROPPATCH,MKCOL,DELETE,(GETSOURCE),(HEADSOURCE),(POSTSOURCE)" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /
Here is where the various statments came from:

AJAX web config <remove verb="*" path="*.asmx"/>
MOSS web config <remove verb="GET,HEAD,POST" path="*" />
AJAX web config <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
AJAX web config <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
MOSS web config <add verb="GET,HEAD,POST" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
MOSS web config <add verb="OPTIONS,PROPFIND,PUT,LOCK,UNLOCK,MOVE,COPY,GETLIB,PROPPATCH,MKCOL,DELETE,(GETSOURCE),(HEADSOURCE),(POSTSOURCE)" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

Don't respond to this thread. It is a duplicate of another started in November of '06.

Here is the URL:

http://forums.asp.net/thread/1468535.aspx

No comments:

Post a Comment