Page view counter

The message received from the server could not be parsed

Last post 11-20-2008 12:14 PM by vadambaibala. 24 replies.

Sort Posts:

  • The message received from the server could not be parsed

    10-23-2006, 8:42 AM
    • Loading...
    • erzki
    • Joined on 09-28-2006, 11:33 AM
    • Posts 23
    • Points 70

    After installning beta 1 I get the following error when an updatepanel updates.

    Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed

     I live in sweden and make use of the characters å ä ö in text on the website. I think this error have something to do with that, but I'm not sure. It worked fine in the July CTP.

  • Re: The message received from the server could not be parsed

    10-23-2006, 9:45 AM
    • Loading...
    • erzki
    • Joined on 09-28-2006, 11:33 AM
    • Posts 23
    • Points 70

    I figured out that it does not depend on the å ä ö characters.

    It works well to update the updatepanel once. But when I update it a second time I get the above error. I have no idea what is wrong.

    What parts is sent int the xml between server and client? <head> etc.. It must be a illegal charcter somewhere in the second postback.

  • Re: The message received from the server could not be parsed

    10-23-2006, 10:18 AM
    • Loading...
    • Luis Abreu
    • Joined on 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • Points 25,660

    hello.

    if i'm not mistaken, the | char is used as a separator but it shouldn't be any problem witht it. can you post a simple page that reproduces the problem?

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: The message received from the server could not be parsed

    10-23-2006, 10:38 AM
    • Loading...
    • erzki
    • Joined on 09-28-2006, 11:33 AM
    • Posts 23
    • Points 70

    I'm developing in a content management system (CMS) called EPIServer, therefore I cannot post all code here. The problem only occur on pages in the CMS system. When I place the code in a seperate file with no CMS it works fine. Maybe you cannot help me because I'm using this CMS system, but it worked very well in the July CTP, so there must have been some changes with the parser or what is being sent in the xml.

     

    The

  • Re: The message received from the server could not be parsed

    10-23-2006, 10:41 AM
    • Loading...
    • erzki
    • Joined on 09-28-2006, 11:33 AM
    • Posts 23
    • Points 70

    I'm developing in a content management system (CMS) called EPIServer, therefore I cannot post all code here. The problem only occur on pages in the CMS system. When I place the code in a seperate file with no CMS it works fine. Maybe you cannot help me because I'm using this CMS system, but it worked very well in the July CTP, so there must have been some changes with the parser or what is being sent in the xml.

     

    The code is the following (whatever I update I get the same error)

    <atlas:UpdatePanel runat="server" id="UpdatePanel1" UpdateMode="Conditional">

    <ContentTemplate>

    <asp:Label runat="server" ID="Label1"></asp:Label><br />

    </ContentTemplate>

    <Triggers>

    <atlas:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />

    </Triggers>

    </atlas:UpdatePanel>

     

    <asp:TextBox runat="server" ID="TextBox1"></asp:TextBox><asp:Button runat="server" ID="Button1" Text="Update"/><br />

    <asp:Button runat="server" ID="ButtonSend" Text="Send" /><br />

    <asp:Label runat="server" ID="LabelID"></asp:Label>

  • Re: The message received from the server could not be parsed

    10-23-2006, 1:51 PM
    • Loading...
    • Luis Abreu
    • Joined on 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • Points 25,660

    hello again.

    hum...that seems like normal code to me. btw, maybe you should use fiddler or another http proxy to get the response being sent back from the server. putting it here may help understanding your error...

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: The message received from the server could not be parsed

    10-25-2006, 9:40 AM
    • Loading...
    • mhil_cbtech
    • Joined on 06-06-2006, 1:55 PM
    • Posts 26
    • Points 82

    I had a similar error that took me like 4 hours to track down. It turned out that someone had stuck a Response.Write line into one of the UserControls on the page. Hope that helps!

     Mark

  • Re: The message received from the server could not be parsed

    10-25-2006, 2:47 PM
    • Loading...
    • lodestar
    • Joined on 07-25-2006, 2:16 PM
    • Posts 6
    • Points 30

    I reproduced the error using the snippet you provided. However, on my site I am using the Blowery HTTP compression module to compress pages. To resolve the problem, I had to disable compression on the page containing this code using the <excludedPaths> element in the web.config.

  • Re: The message received from the server could not be parsed

    11-07-2006, 10:48 AM
    • Loading...
    • erzki
    • Joined on 09-28-2006, 11:33 AM
    • Posts 23
    • Points 70

    I have found out what the problem is but I can't solve it. Maybe someone here can help me.

    I have used fiddler to see what goes wrong. The problem is that our CMS system changes the form action attribute of the aspnet tag <form> on the page when it loads. This is done by a javascript in <head>. This is done to be able to use postbacks on friendly URLs. The form action is set to "/MyPage/Post.aspx e.g. The Post.aspx handles the postbacks correctly. When they did this solution they only thought of usual postbacks not partial ones.

    Ok, the postback for my updatepanel works well the first time because of that the form action is set to Post.aspx. But when the partial postback is executed something changes the form action to the right path of the page. Therefore the next partial postback will not work, because the form action is not set to .../Post.aspx. I have figured out that asp.net AJAX does this change of the form action. it comes from the end of the httpmessage, namely: |formAction||../../templates/Page.aspx?id=30&epslanguage=EN|. This should be something like: |formAction||/Page/Post.aspx|.

    I have found out two solutions, but don't know how to implement them:

    1. Change the httprequest formAction in some way

    2. Add a javascript that changes the form action everytime a partial postback is done. 

    Does anyone here know how to perform 1. or 2.?

    Thanks
     

  • Re: The message received from the server could not be parsed

    11-07-2006, 2:31 PM
    • Loading...
    • fitsner
    • Joined on 11-27-2002, 7:07 AM
    • Posts 32
    • Points 160

    Hi,

    I had the same problem (AJAX + url rewriting) and I implemented a simple response filter:

    using System;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.IO;
    using System.Web;
    
    public class AjaxPageFilter : Stream
    {
        Stream          responseStream;
        long            position;
        StringBuilder   responseHtml;
    
        public AjaxPageFilter(Stream inputStream)
        {
            responseStream = inputStream;
            responseHtml = new StringBuilder ();
        }
    
        public override bool CanRead
        {
            get { return true;}
        }
    
        public override bool CanSeek
        {
            get { return true; }
        }
    
        public override bool CanWrite
        {
            get { return true; }
        }
    
        public override void Close()
        {
            responseStream.Close ();
        }
    
        public override void Flush()
        {
            responseStream.Flush ();
        }
    
        public override long Length
        {
            get { return 0; }
        }
    
        public override long Position
        {
            get { return position; }
            set { position = value; }
        }
    
        public override long Seek(long offset, SeekOrigin origin)
        {
            return responseStream.Seek (offset, origin);
        }
    
        public override void SetLength(long length)
        {
            responseStream.SetLength (length);
        }
    
        public override int Read(byte[] buffer, int offset, int count)
        {
            return responseStream.Read (buffer, offset, count);
        }
    
        public override void Write(byte[] buffer, int offset, int count)
        {
            string finalHtml = System.Text.UTF8Encoding.UTF8.GetString(buffer, offset, count);
    
            // Transform the response
            string formAction = Util.OriginalRequestUrl;
            if (!String.IsNullOrEmpty(formAction))
            {
                finalHtml = Regex.Replace(finalHtml, "\\|\\d+\\|formAction\\|\\|[^\\|]+\\|",
                    "|" + formAction.Length.ToString() + "|formAction||" + formAction + "|",
                    RegexOptions.IgnoreCase);
            }
    
            // Write the response
            byte[] data = System.Text.UTF8Encoding.UTF8.GetBytes(finalHtml);
            responseStream.Write(data, 0, data.Length);   
        }
    }

     You should replace "Util.OriginalRequestUrl" with your code.

    This filter can be attached in some HttpModule for example like this:

        public class UrlRewriter : IHttpModule
        {
            public UrlRewriter()
            {
            }
    
            public void Dispose()
            {
            }
    
            public void Init(HttpApplication application)
            {
                application.BeginRequest += new EventHandler(application_BeginRequest);
                application.ReleaseRequestState += new EventHandler(InstallResponseFilter);
            }
    
            void application_BeginRequest(object sender, EventArgs e)
            {
                HttpContext context = HttpContext.Current;
    
                // original URL
                string url = context.Server.UrlDecode(context.Request.Url.ToString());
    
                // store original URL
                Util.OriginalRequestUrl = url;
    
                // ...
            }
    
            private void InstallResponseFilter(object sender, EventArgs e)
            {
                HttpResponse response = HttpContext.Current.Response;
    
                if (response.ContentType == "text/plain")
                    response.Filter = new AjaxPageFilter(response.Filter);
            }
        }
      Hope that helps.

     

    Feodor Fitsner, MCSD
    CEO, DotNetPanel Company
    DotNetPanel - Secure and Scalable Hosting Management Solution
    http://www.dotnetpanel.com
  • Re: The message received from the server could not be parsed

    11-17-2006, 3:57 AM
    • Loading...
    • erzki
    • Joined on 09-28-2006, 11:33 AM
    • Posts 23
    • Points 70

    Thanks fitsner, your code with some modifications did the thing.

    Do you know anything about performance issues when checking the regex in every request?

  • Re: The message received from the server could not be parsed

    11-17-2006, 4:19 AM
    • Loading...
    • fitsner
    • Joined on 11-27-2002, 7:07 AM
    • Posts 32
    • Points 160

    If the performance is critical you can use compiled Regexp or make a custom scanner (indexOf() and so on).

    Feodor Fitsner, MCSD
    CEO, DotNetPanel Company
    DotNetPanel - Secure and Scalable Hosting Management Solution
    http://www.dotnetpanel.com
  • Re: The message received from the server could not be parsed

    04-02-2007, 9:56 AM
    • Loading...
    • Jaxom
    • Joined on 04-02-2007, 1:49 PM
    • Posts 2
    • Points 2

    A simple soution i found to this whole problem was to declare a Session State Variable in the PageLoad method of the page. The problem went away immediately...

    protected void Page_Load(object sender, EventArgs e)

    {

    if (IsPostBack == false)

    {

    if (Session["Dummy"] == null)

    {

    Session[

    "Dummy"] = 0;

    }

    ...

    }

  • Re: The message received from the server could not be parsed

    07-12-2007, 9:38 PM
    • Loading...
    • jaflores
    • Joined on 07-13-2007, 1:33 AM
    • Posts 1
    • Points 2

     

    Thanks Jaxom, I found the problem and solve it immediately.
  • Re: The message received from the server could not be parsed

    07-18-2007, 6:26 AM
    • Loading...
    • maheshwd
    • Joined on 07-10-2007, 5:37 PM
    • Posts 12
    • Points 6

     Hai i am experiencing the problem same like you but this happens only at the first time  how to solve this

     

Page 1 of 2 (25 items) 1 2 Next >