기타 [vb.net] Cookie 유지 및 갱신
페이지 정보
본문
사용법:)
Cookie = SetCookie(Cookie, .GetAllResponseHeaders)
함수:)
Public Function SetCookie(OldCookie As String, GetAllResponseHeaders As String) As String
Dim V() As String, i As Integer, n As Integer
Dim Cookies() As String = {}
If Not OldCookie Is Nothing Then Cookies = OldCookie.Replace(" ", "").Split(";")
Dim CookieList As New List(Of String)
V = Split(GetAllResponseHeaders, "Set-Cookie: ")
For i = 1 To UBound(V)
V(i) = Split(V(i), ";")(0)
Next
For Each T As String In Cookies
If T.IndexOf("=") > 0 Then CookieList.Add(T)
Next
For i = 1 To V.Length - 1
For n = 0 To CookieList.Count - 1
If Split(CookieList(n), "=")(0) = Split(V(i), "=")(0) Then
CookieList(n) = V(i)
Exit For
End If
Next
If CookieList.Count <= n Then
CookieList.Add(V(i))
End If
Next
SetCookie = Join(CookieList.ToArray, "; ") & ";"
End Function
- 이전글[vb.net] 암호화 키 생성 및 암호화, 복호화 예제 19.10.08
- 다음글[vb.net] 암호 키생성 및 암호화 복호화 19.10.08
댓글목록
등록된 댓글이 없습니다.