<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
Untitled Page
File: Default.aspx.vb
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
Dim userCookie As HttpCookie
userCookie = Request.Cookies("UserID")
If userCookie Is Nothing Then
myLabel.Text = "Cookie doesn't exist! Creating a cookie now."
userCookie = New HttpCookie("UserID", "JoeBlack")
userCookie.Expires = DateTime.Now.AddMonths(1)
Response.Cookies.Add(userCookie)
Else
myLabel.Text = "Welcome back, " & userCookie.Value
End If
End Sub
End Class