Hi,
In the past I used some API to download source code of a website cause it's the FASTER way I found.

These was the code in VB6.0:

VB Code:
  1. Option Explicit
  2. Public Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
  3. Public Declare Function InternetOpenUrl Lib "wininet.dll" Alias "InternetOpenUrlA" (ByVal hInternetSession As Long, ByVal sURL As String, ByVal sHeaders As String, ByVal lHeadersLength As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
  4. Public Declare Function InternetReadFile Lib "wininet.dll" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
  5. Public Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
  6.  
  7. Public Const IF_FROM_CACHE = &H1000000
  8. Public Const IF_MAKE_PERSISTENT = &H2000000
  9. Public Const IF_NO_CACHE_WRITE = &H4000000
  10.        
  11. Private Const BUFFER_LEN = 256
  12.  
  13.  
  14. Public Function GetUrlSource(sURL As String) As String
  15.     Dim sBuffer As String * BUFFER_LEN, iResult As Integer, sData As String
  16.     Dim hInternet As Long, hSession As Long, lReturn As Long
  17.  
  18.     'get the handle of the current internet connection
  19.     hSession = InternetOpen("vb wininet", 1, vbNullString, vbNullString, 0)
  20.     'get the handle of the url
  21.     If hSession Then hInternet = InternetOpenUrl(hSession, sURL, vbNullString, 0, IF_NO_CACHE_WRITE, 0)
  22.     'if we have the handle, then start reading the web page
  23.     If hInternet Then
  24.         'get the first chunk & buffer it.
  25.         iResult = InternetReadFile(hInternet, sBuffer, BUFFER_LEN, lReturn)
  26.         sData = sBuffer
  27.         'if there's more data then keep reading it into the buffer
  28.         Do While lReturn <> 0
  29.             iResult = InternetReadFile(hInternet, sBuffer, BUFFER_LEN, lReturn)
  30.             sData = sData + Mid(sBuffer, 1, lReturn)
  31.         Loop
  32.     End If
  33.    
  34.     'close the URL
  35.     iResult = InternetCloseHandle(hInternet)
  36.  
  37.     GetUrlSource = sData
  38. End Function
  39.  
  40. Now in vb.net I can't do that or I haven't found a way to do the same code...
  41.  
  42. I have few question:
  43.  
  44. 1- Can we use vb6.0 api in vb.net?
  45. 2- Is there a faster way to download source code?
  46. 3- How can I changed the code below to vb.net?