Public Class Cookieless Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Protected WithEvents Message As System.Web.UI.WebControls.Label Protected WithEvents lblName As System.Web.UI.WebControls.Label Protected WithEvents lblEmail As System.Web.UI.WebControls.Label Protected WithEvents lblSignIn As System.Web.UI.WebControls.Label Protected WithEvents txtEmail As System.Web.UI.WebControls.TextBox Protected WithEvents txtName As System.Web.UI.WebControls.TextBox Protected WithEvents ShowCookie As System.Web.UI.HtmlControls.HtmlInputButton Protected WithEvents SignOut As System.Web.UI.HtmlControls.HtmlInputButton Protected WithEvents SignIn As System.Web.UI.HtmlControls.HtmlInputButton 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here End Sub Private Sub SignIn_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SignIn.ServerClick Dim strName As String = txtName.Text Dim strEmail As String = txtEmail.Text Dim SID As String = Session.SessionID Response.Cookies("gc")("name") = strName Response.Cookies("gc")("email") = strEmail Response.Cookies("gc")("SID") = SID Response.Cookies("gc").Expires = _ Date.Now.Today.AddDays(30) txtName.Text = "" txtEmail.Text = "" End Sub Public Function DisplayCookie() Dim Str As String Str = "Your cookie is: " & _ "

Name: " & _ Request.Cookies("gc")("name") & _ "
Email: " & _ Request.Cookies("gc")("email") & _ "

SessionID:
" & _ Request.Cookies("gc")("SID") Message.Text = Str End Function Private Sub ShowCookie_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowCookie.ServerClick If Not Request.Cookies("gc") Is Nothing Then DisplayCookie() Else Message.Text = "There are no cookies." End If End Sub Private Sub SignOut_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SignOut.ServerClick Response.Cookies("gc").Expires = _ Date.Now.Today.AddDays(-1) txtName.Text = "" txtEmail.Text = "" Message.Text = "Your cookie was deleted." End Sub End Class