Below is a straightforward example of code to create a time based greeting in ASP.NET.
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If DateTime.Now.Hour >= 6 And DateTime.Now.Hour < 12 Then
Label1.Text = "Good morning"
ElseIf DateTime.Now.Hour >= 12 And DateTime.Now.Hour < 18 Then
Label1.Text = "Good afternoon"
Else
Label1.Text = "Good evening"
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Time Greeting</title>
</head>
<body>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</body>
</html>
Get the best asp web hosting provider now and save 30%
Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.