Results 1 to 2 of 2

Thread: help Convert Httpwebrequest to Httpclient

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2021
    Posts
    3

    help Convert Httpwebrequest to Httpclient

    I want to convert this code to Httpclient
    Code:
       : Net.ServicePointManager.CheckCertificateRevocationList = False : Net.ServicePointManager.DefaultConnectionLimit = 300 : Net.ServicePointManager.UseNagleAlgorithm = False : Net.ServicePointManager.Expect100Continue = False : Net.ServicePointManager.SecurityProtocol = 3072 Dim Encoding As New Text.UTF8Encoding Dim Bytes As Byte() = Encoding.GetBytes("CAES+w8SRgpECh4IARIQxzwvXOKRWxt2QalqMQgjXvSXYNVNdLMwfJsO3v+qHUbSGX2vO/RLjPDlkVBHXs6HbTMQbVtAjCXX0l4Sxtc7hAK28jZXaaDHSNK9Xkx52ucagAII4UF2tiqM/2FaMcxvjU1W8agGwBPTIiqO3lanEio3EkgSOPKL5HShfFyCoOhHaH7GfFOCzayDwNCKMnUZbeGf/9UuwLUYaeGaT8nqYsetf1zQhFfamQRSAJSvX5skP0qm4h3tUsJSKQUja12+9mwmhmFPlsgr49E+VJAwvASVK9o7F58iMDuaKoziizWVHVF55dQsFbpGshweKEe/6OLanRxawTEUMi36Mgf+FXE6t69d0ChntmxP2ChfRkFdvLHAkIs7cIExSHVTrU4hr9uXdeQRbnlvje8MHvM4qovvCCww4eu+YTXxCDHWidEPeTkTcUXhkrpt/mFDd1IR3UTv") Dim AJ As Net.HttpWebRequest = DirectCast(Net.WebRequest.Create("https://proxies.be/arkena/askLicenseWV?id=67&playerName=viaccessapp&playerVersion=08.07.10&checksum=pnz64MLTmt2Lsct9UGj5dF83YqMvSJ8%3D"), Net.HttpWebRequest) With AJ .Method = "POST" .Proxy = Nothing .Host = "proxies.be" .Accept = "*/*" .ContentType = "application/octet-stream" .Headers.Add("X-AN-WebService-CustomerAuthToken: eyJhbGciOiJSUzI1NiJ9.TpQPYKEAly1ODbhLK2fWgEiAFLykao7dHINGNTDkYfQEsnN39sQ6hSDYDH2GUtuhUsCq2f9fsNOP4aureFgughRwp1SCzUQ60zt3Qk0TOrIs4K0bsIQhtdD8wG9_EMVT4yKRIv2Tf-T2AsD-FolQkeGsZggNw") .Headers.Add("X-AN-WebService-IdentityKey: tLpitRirllhustlziSpiWewrl9") .UserAgent = "VO r" .ContentLength = Bytes.Length End With Dim Stream As IO.Stream = AJ.GetRequestStream() : Stream.Write(Bytes, 0, Bytes.Length) : Stream.Dispose() : Stream.Close() Dim Reader As New IO.StreamReader(DirectCast(AJ.GetResponse(), Net.HttpWebResponse).GetResponseStream()) : Dim text As String = Reader.ReadToEnd : Reader.Dispose() : Reader.Close()

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,945

    Re: help Convert Httpwebrequest to Httpclient

    I assume you are asking for help rather than just stating you want to do something? While I can't answer your question I suggest you post your code formatted something like this:

    Code:
    Net.ServicePointManager.CheckCertificateRevocationList = False
    Net.ServicePointManager.DefaultConnectionLimit = 300
    Net.ServicePointManager.UseNagleAlgorithm = False
    Net.ServicePointManager.Expect100Continue = False
    Net.ServicePointManager.SecurityProtocol = 3072
    
    Dim Encoding As New Text.UTF8Encoding
    Dim Bytes As Byte() = Encoding.GetBytes("CAES+w8SRgpECh4IARIQxzwvXOKRWxt2QalqMQgjXvSXYNVNdLMwfJsO3v+qHUbSGX2vO/RLjPDlkVBHXs6HbTMQbVtAjCXX0l4Sxtc7hAK28jZXaaDHSNK9Xkx52ucagAII4UF2tiqM/2FaMcxvjU1W8agGwBPTIiqO3lanEio3EkgSOPKL5HShfFyCoOhHaH7GfFOCzayDwNCKMnUZbeGf/9UuwLUYaeGaT8nqYsetf1zQhFfamQRSAJSvX5skP0qm4h3tUsJSKQUja12+9mwmhmFPlsgr49E+VJAwvASVK9o7F58iMDuaKoziizWVHVF55dQsFbpGshweKEe/6OLanRxawTEUMi36Mgf+FXE6t69d0ChntmxP2ChfRkFdvLHAkIs7cIExSHVTrU4hr9uXdeQRbnlvje8MHvM4qovvCCww4eu+YTXxCDHWidEPeTkTcUXhkrpt/mFDd1IR3UTv")
    Dim AJ As Net.HttpWebRequest = DirectCast(Net.WebRequest.Create("https://proxies.be/arkena/askLicenseWV?id=67&playerName=viaccessapp&playerVersion=08.07.10&checksum=pnz64MLTmt2Lsct9UGj5dF83YqMvSJ8%3D"), Net.HttpWebRequest)
    
    With AJ
       .Method = "POST"
       .Proxy = Nothing
       .Host = "proxies.be"
       .Accept = "*/*"
       .ContentType = "application/octet-stream"
       .Headers.Add("X-AN-WebService-CustomerAuthToken: eyJhbGciOiJSUzI1NiJ9.TpQPYKEAly1ODbhLK2fWgEiAFLykao7dHINGNTDkYfQEsnN39sQ6hSDYDH2GUtuhUsCq2f9fsNOP4aureFgughRwp1SCzUQ60zt3Qk0TOrIs4K0bsIQhtdD8wG9_EMVT4yKRIv2Tf-T2AsD-FolQkeGsZggNw")
       .Headers.Add("X-AN-WebService-IdentityKey   tLpitRirllhustlziSpiWewrl9")
       .UserAgent = "VO r"
       .ContentLength = Bytes.Length
    End With
    
    Dim Stream As IO.Stream = AJ.GetRequestStream()
    
    Stream.Write(Bytes, 0, Bytes.Length)
    Stream.Dispose()
    Stream.Close()
    
    Dim Reader As New IO.StreamReader(DirectCast(AJ.GetResponse(), Net.HttpWebResponse).GetResponseStream())
    Dim text As String = Reader.ReadToEnd
    
    Reader.Dispose()
    Reader.Close()
    Also what are you trying to accomplish?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width