📄 cookiedictionary.asp
字号:
<%
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -