Page Request Manager Parser Error with AJAX 1.0 (release)

Last post 09-09-2008 9:44 AM by arockiaraj. 3 replies.

Sort Posts:

  • Page Request Manager Parser Error with AJAX 1.0 (release)

    01-26-2007, 2:46 PM
    • Member
      6 point Member
    • rwkreykes
    • Member since 07-09-2006, 5:31 PM
    • Posts 7

    It seems that Session is not properly constituted on the first async (UpdatePanel) post back for the Session.  I have narrowed this down to a simple example:

    Create a new AJAX enabled Web
    Add an UpdatePanel
    Add a Button to the Update Panel.

    In the Button Click method add an item to the Session (i.e. Session["a"] = "a";)

     you will get an Page Request Manager Parser Error on the first click but no error on a subsequent click.  If you wait for the Session to expire the error will occur one time again.

    You can get around the problem by adding an empty Global.asax to your project or adding code to set any value in the Session in the Page_Load method.

    I have the Visual Studio 2005 SP1 installed and the "release" version of all the ASP.NET AJAX components.

    Sample aspx:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <
    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="ScriptManager1" runat="server" />
    <div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
    </ContentTemplate>
    </asp:UpdatePanel>
    </div>
    </form>
    </
    body>
    </
    html>

    Sample cs file:
    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    public partial class _Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    }

     

    protected void Button1_Click(object sender, EventArgs e)
    {
    Session[
    "sv"] = "SomeValue";
    }

    }

    Seems like an realy big bug for a "Production" release. 

     

    Ron Kreykes
  • Re: Page Request Manager Parser Error with AJAX 1.0 (release)

    05-08-2007, 9:14 PM
    • Member
      618 point Member
    • jasonjanofsky
    • Member since 03-19-2004, 6:57 PM
    • San Diego
    • Posts 140

    Got this one figured out.  Followed the examples of others to use fiddler to inspect the session.  There is another page being piggybacked into your page being sent back to the browser which causes the parser error.  The 'piggybacking' page is an error that states something like "Session state has created a session id, but cannot save it because the response was already flushed by the application."  In any case, the fix is to simply add one line of code to the session start method in your global file:

    string sessionId = Session.SessionID;

    or

    dim sessionID as string = Session.SessionID

    Credit where credit is due:

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

     

    Good luck,

    Jason

     

     

    Feel free to hit me on MSN, I will try to help if I am not super busy.
  • Re: Page Request Manager Parser Error with AJAX 1.0 (release)

    09-09-2008, 5:03 AM

    I tried the solutions but it did not work i get "Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0". this appears when i refresh when the loading image(AJAX) is visible(i.e) when the application is still loading but i click on refresh.

  • Re: Page Request Manager Parser Error with AJAX 1.0 (release)

    09-09-2008, 9:44 AM
    • Member
      4 point Member
    • arockiaraj
    • Member since 09-08-2008, 7:32 AM
    • Posts 4

    HI

    Add the following code to your page_load event and your issue getting solved

    If Session["sv"] Is Nothing Then

    {

    Session["sv"] = "SomeValu";

    }

    Thanks,
    Arockiaraj

    P.S. Dont forget to mark this as answer, if you have got resolution to your problem from this post.
Page 1 of 1 (4 items)