(MVC) MVC (2018)

CefSharp.Winforms.ChromiumWebBrowser minimal example on VB.NET (with cookies collector and script executor).

This is cookie collector class

   1:  Imports CefSharp
   2:   
   3:  Public Class CookieMonster
   4:      Implements CefSharp.ICookieVisitor
   5:   
   6:      ReadOnly cookies As List(Of Tuple(Of String, String)) = New List(Of Tuple(Of String, String))()
   7:      ReadOnly gotAllCookies As Threading.ManualResetEvent = New Threading.ManualResetEvent(False)
   8:   
   9:      Private Function ICookieVisitor_Visit(cookie As Cookie, count As Integer, total As Integer, ByRef deleteCookie As Boolean) As Boolean Implements ICookieVisitor.Visit
  10:          cookies.Add(New Tuple(Of String, String)(cookie.Name, cookie.Value))
  11:          If count = total - 1 Then gotAllCookies.[Set]()
  12:          Return True
  13:      End Function
  14:   
  15:      Public Sub WaitForAllCookies()
  16:          gotAllCookies.WaitOne()
  17:      End Sub
  18:   
  19:      Public ReadOnly Property NamesValues As IEnumerable(Of Tuple(Of String, String))
  20:          Get
  21:              Return cookies
  22:          End Get
  23:      End Property
  24:   
  25:  #Region "IDisposable Support"
  26:      Private disposedValue As Boolean ' To detect redundant calls
  27:   
  28:      ' IDisposable
  29:      Protected Overridable Sub Dispose(disposing As Boolean)
  30:          If Not disposedValue Then
  31:              If disposing Then
  32:                  ' TODO: dispose managed state (managed objects).
  33:              End If
  34:   
  35:              ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
  36:              ' TODO: set large fields to null.
  37:          End If
  38:          disposedValue = True
  39:      End Sub
  40:   
  41:      ' TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources.
  42:      'Protected Overrides Sub Finalize()
  43:      '    ' Do not change this code.  Put cleanup code in Dispose(disposing As Boolean) above.
  44:      '    Dispose(False)
  45:      '    MyBase.Finalize()
  46:      'End Sub
  47:   
  48:      ' This code added by Visual Basic to correctly implement the disposable pattern.
  49:      Public Sub Dispose() Implements IDisposable.Dispose
  50:          ' Do not change this code.  Put cleanup code in Dispose(disposing As Boolean) above.
  51:          Dispose(True)
  52:          ' TODO: uncomment the following line if Finalize() is overridden above.
  53:          ' GC.SuppressFinalize(Me)
  54:      End Sub
  55:  #End Region
  56:  End Class


Comments ( )
<00>  <01>  <02>  <03>  <04>  <05>  <06>  <07>  <08>  <09>  <10>  <11>  <12>  <13>  <14>  <15>  <16>  <17>  <18>  <19>  <20>  <21>  <22>  <23
Link to this page: //www.vb-net.com/CefSharp_ChromiumWebBrowser/CookieMonster.htm
<SITEMAP>  <MVC>  <ASP>  <NET>  <DATA>  <KIOSK>  <FLEX>  <SQL>  <NOTES>  <LINUX>  <MONO>  <FREEWARE>  <DOCS>  <ENG>  <CHAT ME>  <ABOUT ME>  < THANKS ME>