Monday, March 26, 2012

PageRequestManagerParserErrorException

I really hope someone can help me...

Scenario:

A button inside an UpdatePanel
If when I click the button I execute a Response.Redirect inside the button's event handler I get aPageRequestManagerParserErrorException exception.

This didn't happen with any of the betas (just updated to 1.0).

Any ideas?

Can you post your code. Do you by any chance call Response.Flush?
The code is quite large but I have found that this can be very easily reproduced.
To reproduce the problem you just have to enclose a button that executes Response.Redirect inside an UpdatePanel:

HTML Code:

<%@. Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Login" %><%@. Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <table id="tblLogin"> <tr> <td>Login</td> <td><asp:TextBox ID="txtLogin" runat="server"></asp:TextBox></td> </tr> <tr> <td>Password</td> <td><asp:TextBox ID="txtPassword" TextMode="Password" runat="server"></asp:TextBox></td> </tr> <tr> <td colspan="2"> <asp:UpdatePanel ID="testPanel" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Button ID="btnLogin" runat="server" Text="Login" /> </ContentTemplate> </asp:UpdatePanel> </td> </tr> </table> <asp:Label id="lblErrorMsg" runat="server" ForeColor="Red"></asp:Label> <div id="dInvBrowser" class="errMsg" style="display:none; color:#FF0000; font-weight:bold;">Por favor, solamente utilice Internet Explorer 6.0 (o superior) para acceder al sistema</div> <script language="javascript" type="text/javascript">if(!IE || SM || OP || KQ || (BV<6)) {//document.getElementById("tblLogin").style.display="none";//document.getElementById("dInvBrowser").style.display="block";}</asp:Content>
Code Behind:
Protected Sub btnLogin_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles btnLogin.Click
Response.Redirect("/testpage.aspx")
End Sub
If I remove the "testPanel" then everything works just fine.
Anyone?Help on this issue will be GREATLY appreciated...

Is the page in question protected by a rolemanager/roleprovider? If so see:

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


No...
Remember this was working perfectly before installing the 1.0 final release of ASP.NET AJAX

Also, you should be able to easily reproduce it: just create an UpdatePanel, insert a button and then simply call Response.Redirect("somee_page.aspx") in the button's click event.


I didn't try your exact code, but I tried this code, and it worked fine... can you spot any differences?

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> public void button_click(object sender, EventArgs e) { Response.Redirect("http://www.microsoft.com"); }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="sm" runat="server" /> <asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Button ID="button" runat="server" OnClick="button_click" Text="Click Me" /> </ContentTemplate> </asp:UpdatePanel> </form></body></html>

Thank you SO much Steve!

By just looking at your code I realized I had something wrong with my application: I did not correctly upgrade from the last beta to the 1.0
So I re-read the documentation to perform the upgrade and everything is now working perfectly.

Again, thank you VERY much.


This a must read from Eilon Lipton's Technical blog on MicrosoftASP.NET and ASP.NET AJAX when trying to solvePageRequestManagerParserErrorException errors!

http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx?CommentPosted=true#commentmessage A

No comments:

Post a Comment