繁体   English   中英

asp.net c#等待操作超时

[英]asp.net c# wait operation time out

我有运行完美的ASP.Net项目。 但我希望它自动刷新,为此我在页面加载中添加了一行代码

代码: Response.AppendHeader("Refresh", "30");

添加此代码后,它可以成功运行4或5次,但之后会出现错误

The wait operation timed out

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

所以我要为那个异常做什么。

我正在使用Visual Studio 2013和SQL Server 2012 ASP.Net C#。

我在页面加载事件中测试了同一行

Response.AppendHeader("Refresh", "5");

但即使10分钟后也没有发生错误。 错误是由其他代码行生成的,您必须搜索或共享整个页面。

第二种方式:(您应该尝试一下)

  protected void Page_Load(object sender, EventArgs e)
  {
    if (!IsPostBack)
    {
        ScriptManager.RegisterStartupScript(this, GetType(), "refresh",      "window.setTimeout('window.location.reload(true);',5000);", true);

    }
}

第三种方式:(通过使用HTML META标签)

将标签添加到头部。 当您使用AJAX等最新技术时,可能不建议这样做。

<meta http-equiv="refresh" content="30">
<meta http-equiv="refresh" content="30;url=Dashboard.aspx"> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM