ASP.NET Ajax Error: Sys.WebForms.PageRequestManagerParserErrorException

后端 未结 15 687
轻奢々
轻奢々 2020-12-05 18:20

My website has been giving me intermittent errors when trying to perform any Ajax activities. The message I get is

Sys.WebForms.PageRequestManagerP         


        
相关标签:
15条回答
  • 2020-12-05 18:48

    This may be a little hacky, but it solved the issue for me. I didn't have any of the common reasons for the error, so I just put in this band-aid in the page load:

    if (Session.SessionID == "")
    {
        Page.Session.Add("SessionID", Session.SessionID);
    }
    
    0 讨论(0)
  • 2020-12-05 18:51

    I also got this error. The solution reported by "user1097991" solved it for a while (I was using not-serialized objects on viewstate)

    But later the error returned again, now in a random fashion. After some search I got the answer: the viewstate was becoming too large and was been truncated. I disable some viewstates on grids and menus and the problem haven't shown again.

    0 讨论(0)
  • 2020-12-05 18:51

    I had exactly the same error.

    For me it was

    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    

    Missing in the httpModules section of web.config (.Net 3.5 app)

    This error seems to may be related to many various things.

    0 讨论(0)
  • 2020-12-05 18:53

    I found that my issue was related to a nul character being rendered in the databinding of a GridView. The expected length of the response wasn't matching the actual length of the response text which resulted in the error being thrown. Once I fixed the data in the database, I no longer got the error. The ultimate fix will be to sanitize the text getting rendered during the RowDataBound event.

    Looking through the database, I couldn't see the bad data since SQL Server 2008 doesn't show the text if the nul character (Char(0)) is in the string. In the RowDataBound event of my GridView, I added code to throw an exception for any text that had special characters in it. This is how I found the record that contained the nul characters.

    tl;dr - Check for nul characters in the rendered html.

    0 讨论(0)
  • 2020-12-05 18:55

    Problem: Sys.WebForms.PageRequestManagerParserErrorException will occur when redirecting your page, lets say button click inside UpdatePanel in aspxAjax.

    SOlution:

    1. Add a "GoTo" button in your aspx page where update panel is using and add it outside Update panel

    2. In your code assign ur just registered userID to session variable , say Session["UseridJustregistered"]=Id from DB or UsernameField

    3. Respose.Redirect("regSucces.aspx?urlid='" + Session["UseridJustregistered"] + "'");

    4. Check if Session["UseridJustregistered"] is null or not

    This is OLD Classic ASP way which can solve our problem , by the time Microsoft find a solution we can tackle it this way.

    0 讨论(0)
  • 2020-12-05 18:55

    Please also be aware that this can be caused by not properly html encoding what you may be rendering to the page through partial postbacks.

    0 讨论(0)
提交回复
热议问题