请看一下下面的代码:
private sub page_load(sender As Object, e As EventArgs)
if request.cookies.item("us")=dbNULL thenresponse.cookies.item("us").expires=now.addmonths(1)
textbox1.text=response.cookies("us").value
end if
end subSub CheckBox1_CheckedChanged(sender As Object, e As EventArgs)
response.cookies("us").value=textbox1.text
response.cookies.item("us").expires=now.addmonths(1)
End Sub我想让cookie记住用户名,可怎么不正确?
private sub page_load(sender As Object, e As EventArgs)
if request.cookies.item("us")=dbNULL thenresponse.cookies.item("us").expires=now.addmonths(1)
textbox1.text=response.cookies("us").value
end if
end subSub CheckBox1_CheckedChanged(sender As Object, e As EventArgs)
response.cookies("us").value=textbox1.text
response.cookies.item("us").expires=now.addmonths(1)
End Sub我想让cookie记住用户名,可怎么不正确?
解决方案 »
- 求asp.net项目中,config.dll文件内容解释
- Timeout 时间已到。在操作完成之前超时时间已过或服务器未响应。
- 能用ASP.NET开发 Call Center吗?
- 如何将DataSet的数据一次全部插入数据库?不要循环!
- 一个Ajax Control Toolkit WebSite,使用CalendarExtender控件,调试正常,发布出错!
- 放分!!!如何设置用户角色!~~顶者有分
- 怎样学好.NET
- asp.net
- 欢迎测试SQL SERVER+ASP.NET+XML建立的高性能的无刷新聊天程序
- 请教专家:如何用程序动态生成Text Object对象, 如何定义Text Object 的属性?,
- 与.net自带的WebPart相比,还有没有更好的WebPart?
- 在textbox中不能输入某个字符,例如“,”,如何写验证表达式?
response.cookies.item("us").expires=now.addmonths(1)
textbox1.text=response.cookies("us").value
end if
end sub
'Put user code to initialize the page here
If Not IsPostBack Then
If Not Request.Cookies("username") Is Nothing Then
Response.Write("last cookid username is " + Request.Cookies("username").Value)
End If
End If
End SubPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Request.Cookies.Clear()
Response.Cookies("username").Value = Format(Now, "yyyy-MM-dd HH:mm:ss")
Response.Cookies("username").Expires = Now.AddMonths(1) Response.Write("current cookie username is " + Request.Cookies("username").Value)
End Sub