Home Asp.net Auto-refresh Webpage in Every 10 Seconds in Asp.net C# Vb.net

Auto-refresh Webpage in Every 10 Seconds in Asp.net C# Vb.net

1
0

Now here in this tutorial, I’ll explain how to auto refresh webpage in every 10 seconds or any specific time intervals using meta tag in asp.net c# or vb.net.If you feel this tutorial is upto the mark, then kindly check out our other tutorials. We ensure you that those tutorials will be as amazing as this one.

In my previous tutorials, I’d explained how to automatically redirect to a specific url in 10 seconds, how to redirect to a specified url or webpage on button click, gridview inline insert update delete and other more cracking tutorials on Asp.net, JavaScript, jQuery here.

 

We can do this by using simple one line of html code, by using html meta tag.

<meta http-equiv=”refresh” content=”10;” />
Note: You just need to place above single line of code in html head tag. Here 10 in content=”10;” is a time duration in seconds, you can freely change as per your need. If you want to redirect user to a specific url or webpage, check this post.

Auto-refresh Webpage – [.aspx]

Following is the complete HTML Markup code that I used for the demonstration:

<html xmlns=”http://www.w3.org/1999/xhtml”>
<head id=”Head1″ runat=”server”>
<meta http-equiv=”refresh” content=”10;” />
<title>Auto Refresh Webpage in every 10 seconds</title>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<br />
<br />
<h3>
Wait for 10 seconds and look at your web browsers tab, It’ll auto refresh page in
every 10 seconds</h3>
</div>
</form>
</body>
</html>

If you want to implement this functionality from code-behind, it’s also as simple as like that. Simply add the following line of code on Page_Load and ignore the above example.

Auto-refresh Webpage Using C# – [.cs]

//Code for C#
Response.AppendHeader(“Refresh”, “10”);

Auto-refresh Webpage Using Vb.net – [.vb]

//Code for Vb.net
Response.AppendHeader(“Refresh”, “10”)

Download Example

[wpdm_package id=’5429′]

Git Repo

LEAVE A REPLY

Please enter your comment!
Please enter your name here
Captcha verification failed!
CAPTCHA user score failed. Please contact us!