Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
454 views
in Technique[技术] by (71.8m points)

c# - How to fix error: The message received from the server could not be parsed

We have a Sharepoint solution that uses AJAX. The button that triggers this is inside an update panel.

One of the things that we do is generate a MS Word document, that is then opened on the client so that it can be printed.

The code that sends the document to the client looks like this:

    void OpenFileInWord(byte[] data)
    {
        Response.Clear();
        Response.AddHeader("Content-Type", "application/msword");
        Response.BinaryWrite(data);
        Response.Flush();
        Response.End();
    }

The error that we are getting is:

Message: 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 Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near '<?mso-application pr'.

We could save the document in Sharepoint first, and then open it from Sharepoint, but we would prefer not to do this.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you have the button inside updatepanel this maybe causing this, if don′t want to move it, just add a trigger for the button on the updatepanel, a postback trigger.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...