在ajax请求上,我们收到此错误:Sys.WebForms.PageRequestManagerParserErrorException:无法解析从服务器收到的消息

发布于 2024-10-05 04:36:44 字数 3821 浏览 7 评论 0原文

我遇到了一个非常奇怪的问题,在互联网上搜索了一整天后,我没有发现任何有帮助的东西。

我们上周上线了我们的网站 www.promatenvision.co.uk,当导航到该网站并单击右上角的“联系方式”时,您会看到一个查询表格,其代码如下(我已经使用正常的更新面板尝试过此操作)而不是 telerik 代码,它做同样的事情)

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="enquiry.ascx.cs" Inherits="Promat.enquiry" %>
<telerik:RadAjaxPanel ID="rap" runat="server" Width="100%" OnAjaxRequest="rap_AjaxRequest"
    LoadingPanelID="ralp">
    <div id="enquiryWrapper">
        <div id="detailsDiv">
            <h2>
                Your Details</h2>
            <p>
                <telerik:RadTextBox ID="txtName" runat="server" Width="180" EmptyMessage="Name" />
            </p>
            <p>
                <telerik:RadTextBox ID="txtTel" runat="server" Width="180" EmptyMessage="Telephone" />
            </p>
            <p>
                <telerik:RadTextBox ID="txtEmail" runat="server" Width="180" EmptyMessage="Email" />
                <asp:HiddenField ID="hidSubject" runat="server" ClientIDMode="Static" />
            </p>
        </div>
        <div id="requestDiv">
            <h2>
                Nature of your enquiry</h2>
            <textarea id="EnqTxtBx" class="enqText" cols="35" rows="8"></textarea>
        </div>
        <div id="submitDiv">
            <h2>
                Submit your request</h2>

            <input id="sendBtn" type="button" class="clickable" onclick="SendEnquiry()" value="SEND" />
            <input id="cancelBtn" type="button" class="clickable" onclick="SlideOut(0,'top','OUT')" value="CANCEL" />

            <div id="EnqMessageDiv" runat="server" style="display: none;">
                <img src="./themes/cross.png" alt="Invalid: " runat="server" id="MessageImg" style="width: 16px; height: 16px;" />
                <asp:Label ID="MessageLbl" runat="server"></asp:Label>
            </div>
        </div>
    </div>
</telerik:RadAjaxPanel>
<telerik:RadScriptBlock ID="rsb" runat="server">
    <script type="text/javascript">
        function SendEnquiry() 
        { 
            var oAjax = <%= rap.ClientID %>; 
            var txtBx = document.getElementById("EnqTxtBx");
            var EnqTxt = txtBx.value; 
            oAjax.ajaxRequest("Enq|"+EnqTxt+"|"); 
        }
    </script>
</telerik:RadScriptBlock>
<telerik:RadAjaxLoadingPanel ID="ralp" Runat="server" Skin="Default" Transparency="50">
</telerik:RadAjaxLoadingPanel>

现在,如果您单击“发送”,则什么也不会发生,在 IE 中执行此操作时,您可以看到实际上抛出了一个 javascript 错误:

Message: Sys.WebForms.PageRequestManagerParserErrorException: The无法解析从服务器收到的消息。 线路:868 字符:13 代码: 0

第 868 行是以下 ajax 函数:

function Sys$WebForms$PageRequestManager$_endPostBack(error, executor, data) {
        if (this._request === executor.get_webRequest()) {
            this._processingRequest = false;
            this._additionalInput = null;
            this._request = null;
        }
        var handler = this._get_eventHandlerList().getHandler("endRequest");
        var errorHandled = false;
        if (handler) {
            var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor);
            handler(this, eventArgs);
            errorHandled = eventArgs.get_errorHandled();
        }
        if (error && !errorHandled) {
            throw error;
        }
    }

现在,如果您访问 www.promatenvision.co.uk/promat.aspx (这是托管它的 IIS 7 中的默认文档)并尝试它,那么它就可以工作。从现在开始,无论您在哪个页面上,代码都可以正常工作,因为它会保留在 promat.aspx 上,更改查询字符串以导航网站。回到 URL 末尾添加 .co.uk 的情况,它再次中断。

有人可以帮助我吗,因为我不知道下一步该去哪里?

预先非常感谢,

马克

I am having an issue which is really bizzare and after searching through the internet all day I have found nothing that has helped.

We went live with our website www.promatenvision.co.uk last week and when navigating to the website and clicking contact in the top right you are shown an enquiry form, the code for which is below (I have tried this with normal update panels rather than the telerik code and it does the same thing)

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="enquiry.ascx.cs" Inherits="Promat.enquiry" %>
<telerik:RadAjaxPanel ID="rap" runat="server" Width="100%" OnAjaxRequest="rap_AjaxRequest"
    LoadingPanelID="ralp">
    <div id="enquiryWrapper">
        <div id="detailsDiv">
            <h2>
                Your Details</h2>
            <p>
                <telerik:RadTextBox ID="txtName" runat="server" Width="180" EmptyMessage="Name" />
            </p>
            <p>
                <telerik:RadTextBox ID="txtTel" runat="server" Width="180" EmptyMessage="Telephone" />
            </p>
            <p>
                <telerik:RadTextBox ID="txtEmail" runat="server" Width="180" EmptyMessage="Email" />
                <asp:HiddenField ID="hidSubject" runat="server" ClientIDMode="Static" />
            </p>
        </div>
        <div id="requestDiv">
            <h2>
                Nature of your enquiry</h2>
            <textarea id="EnqTxtBx" class="enqText" cols="35" rows="8"></textarea>
        </div>
        <div id="submitDiv">
            <h2>
                Submit your request</h2>

            <input id="sendBtn" type="button" class="clickable" onclick="SendEnquiry()" value="SEND" />
            <input id="cancelBtn" type="button" class="clickable" onclick="SlideOut(0,'top','OUT')" value="CANCEL" />

            <div id="EnqMessageDiv" runat="server" style="display: none;">
                <img src="./themes/cross.png" alt="Invalid: " runat="server" id="MessageImg" style="width: 16px; height: 16px;" />
                <asp:Label ID="MessageLbl" runat="server"></asp:Label>
            </div>
        </div>
    </div>
</telerik:RadAjaxPanel>
<telerik:RadScriptBlock ID="rsb" runat="server">
    <script type="text/javascript">
        function SendEnquiry() 
        { 
            var oAjax = <%= rap.ClientID %>; 
            var txtBx = document.getElementById("EnqTxtBx");
            var EnqTxt = txtBx.value; 
            oAjax.ajaxRequest("Enq|"+EnqTxt+"|"); 
        }
    </script>
</telerik:RadScriptBlock>
<telerik:RadAjaxLoadingPanel ID="ralp" Runat="server" Skin="Default" Transparency="50">
</telerik:RadAjaxLoadingPanel>

Now then, if you click send, nothing happens at all and when doing this in IE you can see that a javascript error is actually thrown:

Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.
Line: 868
Char: 13
Code: 0

The line 868 is the following ajax function:

function Sys$WebForms$PageRequestManager$_endPostBack(error, executor, data) {
        if (this._request === executor.get_webRequest()) {
            this._processingRequest = false;
            this._additionalInput = null;
            this._request = null;
        }
        var handler = this._get_eventHandlerList().getHandler("endRequest");
        var errorHandled = false;
        if (handler) {
            var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor);
            handler(this, eventArgs);
            errorHandled = eventArgs.get_errorHandled();
        }
        if (error && !errorHandled) {
            throw error;
        }
    }

Now then, if you go to www.promatenvision.co.uk/promat.aspx (this is the default docunment in IIS 7 where it is hosted) and try it then it works. From now on, no matter what page you are on the code works as it stays on promat.aspx changing the query string to navigate the site. Go back to having .co.uk on the end of the URL and it breaks again.

Can someone please help me as I have no idea where to go next?

Thanks so much in advance,

Mark

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乄_柒ぐ汐 2024-10-12 04:36:44

我检查了您的代码,认为您必须像这样更改它:

<telerik:RadCodeBlock ID="rcb" runat="server">
<script type="text/javascript">
    function SendEnquiry() 
    { 
        var oAjax = $find('<%= rap.ClientID %>'); 
        var txtBx = document.getElementById("EnqTxtBx");
        var EnqTxt = txtBx.value; 
        oAjax.ajaxRequest("Enq|"+EnqTxt+"|"); 
    }
</script>
</telerik:RadCodeBlock>

并且使用 RadCodeBlock 而不是 RadScriptBlock

I reviewed your code and think that you have to change it like this:

<telerik:RadCodeBlock ID="rcb" runat="server">
<script type="text/javascript">
    function SendEnquiry() 
    { 
        var oAjax = $find('<%= rap.ClientID %>'); 
        var txtBx = document.getElementById("EnqTxtBx");
        var EnqTxt = txtBx.value; 
        oAjax.ajaxRequest("Enq|"+EnqTxt+"|"); 
    }
</script>
</telerik:RadCodeBlock>

and use RadCodeBlock instead of RadScriptBlock.

Oo萌小芽oO 2024-10-12 04:36:44

我们通过将 iis 服务器上的应用程序池的管道模式设置为集成模式而不是经典模式来解决此问题。

We solved this issue by setting the pipeline mode of the app pool on our iis server to integrated instead of classic.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文