c# - 如何修复错误 : The message received from the server could not be parsed

标签 c# ajax sharepoint

我们有一个使用 AJAX 的 Sharepoint 解决方案。触发此操作的按钮位于更新面板内。

我们所做的其中一件事是生成一个 MS Word 文档,然后在客户端上打开它以便打印。

将文档发送到客户端的代码如下所示:

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

我们得到的错误是:

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'.

我们可以先将文档保存在 Sharepoint 中,然后再从 Sharepoint 打开它,但我们不希望这样做。

最佳答案

如果您在更新面板中有按钮,这可能会导致此问题,如果不想移动它,只需为更新面板上的按钮添加一个触发器,一个回发触发器。

关于c# - 如何修复错误 : The message received from the server could not be parsed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1554728/

相关文章:

javascript - 如何将自定义字体添加到 SharePoint Online?

Sharepoint - 如何仅返回最新的公告

c# - 具有多个参数的 WCF Rest GET

c# - ASP.Net 自动生成的管理工具

c# - 如何按存储在我的列表 <> 保存的结构中的整数对列表 <> 进行排序

javascript - 程序的结构?

sharepoint - PowerShell与SharePoint的不同用法?

C#访问iPhone构建的网页

javascript - 我的 jquery ajax 代码有什么问题

javascript - 同步/异步 AJAX 功能模式