Here is my current function which uses a Winsock control (on a seperate form) to connect to a server, send an HTTP Request, and recieve/handle the returned data:

VB Code:
  1. Public Function GetHTTP(htype As HTTPType, strUrl As String, Optional strcookie As String, Optional strrefer As String, Optional strData As String, Optional GZIP As Boolean = True) As String
  2.     Dim strServer As String
  3.     Dim strPage As String
  4.     Dim header As String
  5.  
  6.     frmMain.sck1.Close
  7.     Connected = False
  8.  
  9.     If InStr(1, strUrl, "http://") Then
  10.         strUrl = Replace(strUrl, "http://", "")
  11.     End If
  12.  
  13.     iStart = InStr(6, strUrl, ".") + 4
  14.     strPage = Mid$(strUrl, iStart, (Len(strUrl) + 1) - iStart)
  15.     strServer = Replace(strUrl, strPage, "")
  16.     strPage = Replace(strPage, " ", "%20")
  17.     StrReturn = ""
  18.  
  19.     frmMain.sck1.Connect strServer, 80
  20.  
  21.     Do Until Connected = True Or frmMain.sck1.State = 9
  22.         DoEvents
  23.     Loop
  24.  
  25.     If frmMain.sck1.State = 9 Then
  26.         MsgBox "Error connecting to server!"
  27.         frmMain.sck1.Close
  28.         Exit Function
  29.     End If
  30.  
  31.     header = CreateHeader(htype, strServer, strPage, strcookie, strrefer, strData, GZIP) 'Creates an HTTP Request
  32.     frmMain.sck1.SendData header
  33.  
  34.     Do Until frmMain.sck1.State = 8
  35.         DoEvents
  36.     Loop
  37.  
  38.     lngPos = InStr(1, StrReturn, vbCrLf & vbCrLf)
  39.     If InStr(1, StrReturn, "text/html; charset=UTF-8" & vbNewLine & vbNewLine) Then
  40.     ' Future Handle '
  41.     ElseIf StrReturn <> "" And GZIP = True Then
  42.         Strheader = Left(StrReturn, lngPos - 1)
  43.         StrReturn = Right$(StrReturn, Len(StrReturn) - lngPos - 3)
  44.         StrReturn = DecompressGzipData(StrReturn, LenB(StrReturn))
  45.         StrReturn = Strheader & vbNewLine & vbNewLine & StrReturn
  46.     End If
  47.  
  48.     Connected = False
  49.     GetHTTP = StrReturn
  50.     glastpage = strUrl
  51.     frmMain.sck1.Close
  52. End Function

I need to know the best method for doing what I did above in VB.NET. I know there are multiple ways of accessing the net through the language, but I prefer to stick with simple connecting to server, and retreiving data. Can anyone suggest the best method for doing this? And yes, I also need to handle GZIP Compressed data, in VB6 I have to use an external DLL, but I think it's possibly to do it internally in .NET.