cookiedictionary.asp

来自「WAPmo手机网站管理平台是一款创建与管理维护WAP网站的的软件产品」· ASP 代码 · 共 71 行

ASP
71
字号
<%
Class ImplMocomUtilCookieDictionary
Public Domain, Expires, Path
Private objItem, objBase16
Private strCookieName, strCookieColumn, strCookieBreak
Private blnModify

Private Sub Class_Initialize()
    Set objItem = Server.CreateObject(PROGID_HASH)
    Set objBase16 = vbsre.mocom.util.Base16
    strCookieBreak = Chr(1)
    blnModify = False
End Sub

Private Sub Class_Terminate()
    If blnModify Then
        Response.Cookies(strCookieName) = objBase16.Encode(Join(objItem.Items, strCookieBreak))
        If Not IsEmpty(Domain) Then Response.Cookie(strCookieName).Domain = Domain
        If Not IsEmpty(Expires) Then Response.Cookie(strCookieName).Expires = Expires
        If Not IsEmpty(Path) Then Response.Cookie(strCookieName).Path = Path
    End If
    Set objBase16 = Nothing
    Set objItem = Nothing
End Sub

Public Property Let Name(ByVal strValue)
    strCookieName = strValue
End Property

Public Property Let Column(ByVal strValue)
    Dim strCookieData
    Dim arr1, arr2, i
    strCookieColumn = strValue
    arr1 = Split(strCookieColumn, "|")
    For i = 0 To UBound(arr1)
        objItem(arr1(i)) = Empty
    Next
    strCookieData = Request.Cookies(strCookieName)
    If strCookieData = "" Then Exit Property
    strCookieData = objBase16.Decode(strCookieData)
    If strCookieData = "" Then Exit Property
    arr2 = Split(strCookieData, strCookieBreak)
    If UBound(arr1) <> UBound(arr2) Then Exit Property
    For i = 0 To UBound(arr1)
        objItem(arr1(i)) = arr2(i)
    Next
End Property

Public Default Property Get Item(ByVal strName)
    If Not objItem.Exists(strName) Then
        Err.Raise vbObjectError + 1, "CookieDictionary.Item", "Missing key: " & strName
    Else
        Item = objItem(strName)
    End If
End Property

Public Property Let Item(ByVal strName, vtValue)
    If Not objItem.Exists(strName) Then
        Err.Raise vbObjectError + 1, "CookieDictionary.Item", "Missing key: " & strName
    Else
        objItem(strName) = vtValue
        blnModify = True
    End If
End Property

Public Function newInstance()
    Set newInstance = New ImplMocomUtilCookieDictionary
End Function
End Class
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?