asp.net cookies最保險的用法
阿新 • • 發佈:2019-01-05
Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Response.Cookies("login")("username") = "aaa" Response.Cookies("login")("password") = "bbb" Request.Cookies.Clear() Dim hc As HttpCookie = Request.Cookies("login") 'Dim s As String = Request.Cookies("login").ToString() If Nothing IsNot hc Then Dim username As String = hc("username").ToString() Dim password As String = hc("password").ToString() Response.Write(username) Response.Write(password) End If End Sub End Class