hi, try these sample code below-
default.aspx.vb
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Public Partial Class Default1
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs)
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs)
Dim c1 As New HttpCookie("click")
Dim c2 As New HttpCookie("click1")
c1.Value = TextBox1.Text
c2.Value = TextBox2.Text
c1.Expires = DateTime.Now.AddHours(1) 'cookiee validity of 1 hrs
c2.Expires = DateTime.Now.AddHours(1) 'cookiee validity of 1 hrs
Response.Cookies.Add(c1)
Response.Cookies.Add(c2)
Response.Redirect("Default2.aspx")
End Sub
default2.aspx.vb
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Public Partial Class Default2
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs)
TextBox1.Text = Request.Cookies("Click").Value
TextBox2.Text = Request.Cookies("Click1").Value
End Sub
End Class
default.aspx
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Data Enter</title>
<style type="text/css">
.style1
{
width: 275px;
border-style: solid;
border-width: 1px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table cellpadding="2" class="style1">
<tr>
<td>
first name</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" Width="142px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
last name </td>
<td>
<asp:TextBox ID="TextBox2" runat="server" Width="142px"></asp:TextBox>
</td>
<tr>
<td>
</td>
<td>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
default2.aspx
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Cookie Show</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
*codes are converted from c# to VB.net. and used cookiee to pass values.
I hope it helped.