寫法
Dim myCookieContainer As CookieContainer = New CookieContainer
Sub T_Cookie()
Dim cookieStr As String = web.WebBrowser1.Document.Cookie
Dim cookstr() As String = cookieStr.Split(";")
Dim ck As Cookie
Try
For Each str As String In cookstr
Dim cookieNameValue() As String = str.Split("=")
If cookieNameValue.Length > 1 Then
ck = New Cookie(cookieNameValue(0).Trim().ToString(), cookieNameValue(1).Trim().ToString())
Else
ck = New Cookie(cookieNameValue(0).Trim().ToString(), "")
End If
ck.Domain = "www.youwant.com.tw"
myCookieContainer.Add(ck)
Next
Catch ex As Exception
Me.Text = ex.ToString
End Try
End Sub
留言列表