[英]Sys.WebForms.PageRequestManagerServerErrorException
I am using the asp.net with c# and using the update pannel as well as flash control i am getting the error sometime not all time and no page navigate after then plz help me out 我正在使用带有c#的asp.net并使用更新pannel以及flash控件我有时会得到错误并不是所有时间都没有页面导航然后plz帮助我
following is the massange on the pop up window:- 以下是弹出窗口中的大量文件: -
"Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0" “Sys.WebForms.PageRequestManagerServerErrorException:在服务器上处理请求时发生未知错误。从服务器返回的状态代码为:0”
Please Help me out sence may on the demo time the application may carsh 请帮助我在应用程序可能出现的演示时间
What I remember is, this error was occuring in my case when a calendar control was clicked and it posted back to fill value in textbox. 我记得的是,在我的情况下,当点击日历控件并将其回发到文本框中的填充值时,会出现此错误。 This calendar control was in UpdatePanel. 此日历控件位于UpdatePanel中。 During this calendar control post back if I click a button which is not in UpdatePanel (and causes page to post back) then this error occurs. 在此日历控件回发期间,如果我单击一个不在UpdatePanel中的按钮(并导致页面回发),则会发生此错误。
You can follow this: http://msdn.microsoft.com/en-us/library/bb398934.aspx 你可以这样: http : //msdn.microsoft.com/en-us/library/bb398934.aspx
By adding this script you can avoid displaying of error. 通过添加此脚本,您可以避免显示错误。
<script type="text/javascript" language="javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) {
if (args.get_error() != undefined) {
var errorMessage;
if (args.get_response().get_statusCode() == '200') {
errorMessage = args.get_error().message;
}
else {
// Error occurred somewhere other than the server page.
errorMessage = 'An unspecified error occurred. ';
}
args.set_errorHandled(true);
}
}
</script>
Error 0 means there was no error. 错误0表示没有错误。 I don't know why it happens, but when it does, I just mark the error as handled and nothing blows up. 我不知道它为什么会发生,但是当它发生时,我只是将错误标记为已处理而没有任何事情发生。 Just add the following JavaScript and you're troubles will disappear. 只需添加以下JavaScript,您的麻烦就会消失。
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<script type="text/javascript" >
(function() {
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm)
{
prm.add_endRequest(
function (sender, args) {
// Any code you want here
if(args.get_error() && args.get_error().name === 'Sys.WebForms.PageRequestManagerServerErrorException')
{
args.set_errorHandled(args._error.httpStatusCode == 0);
}
});
}
})();
</script>
</form>
</body>
</html>
I've managed to generate a similar error with a repeater which used alternating rows where one of the controls was missing from the alternating styles. 我设法使用转发器生成类似的错误,转发器使用交替行,其中一个控件从交替样式中丢失。 For example, 'Literal1' was defined in the <ItemTemplate>
but not the <AlternatingItemTemplate>
. 例如,'Literal1'在<ItemTemplate>
定义,但不在<AlternatingItemTemplate>
。 I realize this question has been answered, but hopefully this will save someone some debugging time. 我意识到这个问题已得到解答,但希望这可以节省一些调试时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.