Hi RichardSa,
Use Ajax timer control to check the time.
Refer below example.
HTML
<asp:ScriptManager runat="server" />
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Timer ID="timer1" runat="server" OnTick="timer1_Tick" Interval="1000"></asp:Timer>
<asp:Label ID="lblTime" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
Code
C#
protected void timer1_Tick(object sender, EventArgs e)
{
DateTime startTime = new DateTime(2021, 08, 19, 16, 50, 00);
DateTime endTime = new DateTime(2021, 08, 19, 18, 05, 00);
if (DateTime.Now > startTime && DateTime.Now < endTime)
{
// Do your task.
lblTime.Text = DateTime.Now.ToString();
}
}
VB.Net
Protected Sub timer1_Tick(ByVal sender As Object, ByVal e As EventArgs)
Dim startTime As DateTime = New DateTime(2021, 08, 19, 16, 50, 00)
Dim endTime As DateTime = New DateTime(2021, 08, 19, 18, 05, 00)
If DateTime.Now > startTime AndAlso DateTime.Now < endTime Then
lblTime.Text = DateTime.Now.ToString()
End If
End Sub