简体   繁体   中英

how to refresh page after 30 minutes automatically without run the project using c#(asp.net)

我有一个 C# asp.net 应用程序,我需要每 30 分钟自动刷新一个页面,而无需使用 c#(asp.net) 运行该项目。

Use Mata Tags

<META HTTP-EQUIV="REFRESH" CONTENT="1800">

Other way is to use JavaScript:

setTimeout(function, milliseconds) Executes a function, after waiting a specified number of milliseconds.

setInterval(function, milliseconds) Same as setTimeout() , but repeats the execution of the function continuously.

setTimeout("location.reload(true);", timeout);

Edit: In reality, this is standard HTML functionality and nothing specific to ASP.NET . The same effect of auto-refresh would be seen whether it is an ASP.NET page or just a HTML page, or a page made in Java, PHP, ColdFusion, Perl or the like.

If you want to set the refresh time dynamically then that can be done in ASP.NET by adding server side code in the Page_Load function to set it like below:

Response.AppendHeader("Refresh", "1800")

你应该在头部标签中尝试这个 -

 <meta http-equiv="refresh" content="1800">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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