Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8389311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:41:35+00:00 2026-06-09T18:41:35+00:00

Here is my code, it took me forever to write being I’m still a

  • 0

Here is my code, it took me forever to write being I’m still a nube:

Imports System.Net
Imports System.Text
Imports System.IO

Public Class Form1

Dim logincookie As CookieContainer

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles      Button1.Click

    Dim postdata As String = "action=do_login&url=https%3A%2F%2Fforum.suprbay.org% 2F&quick_login=1&quick_username=USERNAME&quick_password=PASSWORD&submit=Login&quick_remember=yes"
    Dim tempcookies As New CookieContainer
    Dim encoding As New UTF8Encoding
    Dim bytedata As Byte() = encoding.GetBytes(postdata)
    Dim postreq As HttpWebRequest = DirectCast(WebRequest.Create("https://forum.suprbay.org/member.php"), HttpWebRequest)

    postreq.Method = "POST"
    postreq.KeepAlive = True
    postreq.CookieContainer = tempcookies
    postreq.ContentType = "application/x-www-forum-urlencoded"
    postreq.Referer = "https://forum.suprbay.org/member.php"
    postreq.UserAgent = "Mozilla/5.0 (Windows NT 6.2; rv:9.0.1) Gecko/20100101  Firefox/9.0.1"
    postreq.ContentLength = bytedata.Length

    Dim postreqstream As Stream = postreq.GetRequestStream()
    postreqstream.Write(bytedata, 0, bytedata.Length)
    postreqstream.Close()
    Dim postresponse As HttpWebResponse
    postresponse = DirectCast(postreq.GetResponse(), HttpWebResponse)

    tempcookies.Add(postresponse.Cookies)
    logincookie = tempcookies

    Dim postreqreader As New StreamReader(postresponse.GetResponseStream)
    Dim thepage As String = postreqreader.ReadToEnd

    RichTextBox1.Text = thepage

    End Sub

End Class

When I run it and click the button, I get the following error:

“The underlying connection was closed: Could not establish trust
relationship for the SSL/TLS secure channel.”

It is the official forum of PirateBay.Se which is a torrent website, and if you go to it in a regular browser you get the warning about the trust certificate, so that is probably why I’m getting the error, right? How can I ignore the trust certificates and stuff so my application can work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:41:36+00:00Added an answer on June 9, 2026 at 6:41 pm

    This line should ignore the trust errors on the connection, do this before you try to connect:

    ServicePointManager.ServerCertificateValidationCallback = AddressOf ValidateRemoteCertificate
    

    You will need to have this defined in your class as well:

       Public Shared Function ValidateRemoteCertificate(ByVal sender As Object, ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
            Return True
        End Function
    

    Sorry if this is not a perfect translation to VB.Net, i had this in C# originally.

    EDIT:

    And yes, that is exactly why you are getting this error, the cert they have is expired.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here a code to demonstrate an annoying problem: class A { public: A(): m_b(1),
Here is code example class A{ int i; public: A(int i) : i(i) {}
C#, Net 2.0 Here's the code (I took out all my domain-specific stuff, and
I have the following code: using System.Configuration; namespace test { public partial class MyService
I took some code here: Check if role consists of particular user in DB?
I took this sample code here : Django ORM: Selecting related set polls =
Here's a minimal version of the code that took me a lot of time
It took me FOREVER to finally find code that can download a doc file
I took some code from some questions here in SO as well as some
Edit: The code here still has some bugs in it, and it could do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.