-----Original Message-----
Imports System
Imports System.IO
Imports System.Net
Imports System.Threading
Imports System.Text.RegularExpressions
Imports System.Text.Encoding
Imports System.Security.Cryptography.X509Certificates
Public Class TrustAllCertificatePolicy
Implements System.Net.ICertificatePolicy
Public Function CheckValidationResult(ByVal srvPoint As
System.Net.ServicePoint, ByVal certificate As
System.Security.Cryptography.X509Certificates.X509Certific ate, ByVal
request
As System.Net.WebRequest, ByVal certificateProblem As Integer) _
As Boolean Implements
System.Net.ICertificatePolicy.CheckValidationResult
Return True
End Function
End Class
Private Sub cmdGet_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdGet.Click
'Create(a) 'WebRequest' object with the specified url
System.Net.ServicePointManager.CertificatePolicy = New
TrustAllCertificatePolicy
Dim myWebRequest As WebRequest
'myWebRequest.Credentials = myCert.TrustAllCertificatePolicy
myWebRequest =
WebRequest.Create ("
https://sentri.us.nortel.com:8443/SENTRI/home.jsp")
' Send the 'WebRequest' and wait for response.
Dim myWebResponse As WebResponse
myWebResponse = myWebRequest.GetResponse()
' Call method 'GetResponseStream' to obtain stream associated with
the response object
Dim ReceiveStream As Stream
ReceiveStream = myWebResponse.GetResponseStream()
Dim encode As System.Text.Encoding
encode = GetEncoding("utf-8")
' Pipe the stream to a higher level stream reader with the required
encoding format.
Dim readStream As New StreamReader(ReceiveStream, encode)
'txtLog.Text = (ControlChars.CrLf + "Response stream received")
Dim read(1024) As [Char]
' Read 256 charcters at a time .
Dim count As Integer = readStream.Read(read, 0, 1024)
txtLog.Text = ""
'While count > 0
While readStream.Peek >= 0
' Dump the 256 characters on a string and display the string
onto the console.
Dim str As New [String](read, 0, count)
txtLog.Text = txtLog.Text & (str)
count = readStream.Read(read, 0, 1024)
End While
Dim str2 As New [String](read, 0, count)
txtLog.Text = txtLog.Text & (str2)
count = readStream.Read(read, 0, 1024)
'Console.WriteLine("")
' Release the resources of stream object.
readStream.Close()
' Release the resources of response object.
myWebResponse.Close()
End Sub
Does anyone know how to accept all certificates when a
site is browsed to through the axwebbrowser in a windows
application?
Thanks.
.