1

AndroidでCookieコンテナを作成するには?

vb.net で、webclient が継承していることがわかりました。このようなものです:

  **Private cookieCont As New Net.CookieContainer()**

  Private lastPage As String

  Protected Overrides Function GetWebRequest(ByVal address As System.Uri) As System.Net.WebRequest
    Dim wr = MyBase.GetWebRequest(address)
    If TypeOf wr Is Net.HttpWebRequest Then
      With DirectCast(wr, Net.HttpWebRequest)

        **.CookieContainer = cookieCont**

        If lastPage IsNot Nothing Then
          .Referer = lastPage
        End If
      End With
    End If
    lastPage = address.ToString()
    Return wr
  End Function

ありがとう!

4

2 に答える 2

0

これは、CookieManager を使用して実現できます。以下のリンクをご覧ください

https://stackoverflow.com/a/11118377/251148

于 2015-04-19T21:39:31.000 に答える
0

CookieManager を使用できます。HTTP を使用すると Cookie が自動的に管理されます。カスタム CookieStore とカスタム CookiePolicy を使用してカスタマイズすることもできます。

http://docs.oracle.com/javase/tutorial/networking/cookies/index.html

このリンクは、CookieManager をカスタマイズする方法を学ぶことができます

于 2016-05-18T14:42:15.513 に答える