WebClient over https with self signed certificate

Uncue75

New member
Joined
Jun 2, 2008
Messages
1
Programming Experience
Beginner
Hi. I'm new here. I used to do cold fusion development a long time ago. I now work for a security consulting company. I have been tasked with providing a client a way to distribute data over https. I'm providing this solution to asp.net developers. I've figured out how to use webclient to screen scrap what's on a web page, save it to a variable and then output it. My issue is I get an error when trying to do this over https with a self signed certificate. I've looked up documentation on WebClient, but I can't figure out how to tell it accept a self signed certificate. Can anyone explain this in detail? Possibly a code example. I know I'm asking for a lot. I'd describe my asp.net skills as beginner.

thanks




Code:

VB.NET:
Dim req as New WebClient() 

Dim myCache As New CredentialCache() 

Dim link as String

link = "https://myserver:myport"


myCache.Add(New Uri(link), "Basic", _ 
	New NetworkCredential("user", "password")) 



req.Credentials = myCache 

Dim results as String 

results = System.Text.Encoding.UTF8.GetString(req.DownloadData(link))

HTML:
<html> <head> <title>Test</title> </head> 
<body bgcolor="#FFFFFF"> 
<p><%=results %></p> 
</body> 
</html>
 
Back
Top