1

How make Cookie container in android?

I found that in vb.net, in webclient inherits. is like this:

  **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

Thanks!

sls
  • 11
  • 3

2 Answers2

0

This can be achieved using CookieManager. Have a look at the link below

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

Community
  • 1
  • 1
Randeep
  • 403
  • 1
  • 4
  • 11
0

you can use CookieManager,it will auto manage the cookie when you use HTTP,you also can custom it with customed CookieStore and customed CookiePolicy

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

this link can learn how to custom the CookieManager

Jeffery Ma
  • 3,051
  • 1
  • 23
  • 26