Dim rac As String = "peter"
Dim rpw As String = "123"
Dim myac, mypw As TextBox
Dim mysave As CheckBox
dim mytimes as integer
Dim dtday As Date = DateAdd("D", -365, Today)
myac = PreviousPage.FindControl("Textbox1")
mypw = PreviousPage.FindControl("Textbox2")
mysave = PreviousPage.FindControl("ck1")
If myac.Text = rac And mypw.Text = rpw Then
Label1.Text = "登入成功"
If Request.Cookies("mytimes1") IsNot Nothing Then
mytimes= cInt(request.cookies("mytimes1").Value)
else
mytimes = 1
end if
label2.text="已經登入" & CSTR(mytimes) &"次"
mytimes=mytimes+1
response.cookies("mytimes1").value=CSTR(mytimes)
If mysave.Checked = True Then
Response.Cookies("user1").Value = myac.Text
Response.Cookies("passw1").Value = mypw.Text
Response.Cookies("mytimes1").Value = mytimes
Else
If Request.Cookies("user1") IsNot Nothing Then
Request.Cookies("user1").Expires = dtday
End If
End If
Else
Label1.Text = "登入失敗"
End If