Results 1 to 7 of 7

Thread: Ive looked everywhere: How do i download HTML for a web page?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    98

    Ive looked everywhere: How do i download HTML for a web page?

    I know you could do thin is VB 6, but i cannot find anything on any webpages for VB.net

  2. #2

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    98
    thats C#

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    But more importantly, it is .Net. Look at it, you can figure out what classes they use to get the source.

  5. #5
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    OK, I did a quick translation... I don't guarentee the work though, it was from my head.
    VB Code:
    1. Public Function DownloadURL(url As String) As String
    2. Dim returnString As String
    3. Dim req As WebRequest = new WebRequest.Create(url)
    4. Dim res As WebResponse = req.GetResponse()
    5. Dim totalBuffer As Integer = 0
    6. Dim buffer() As Byte = new Byte(128)
    7. Dim stream As Stream = res.GetResponseStream()
    8. totalBuffer = stream.Read(buffer,0,128)
    9. Dim strRes As StringBuilder = new StringBuilder("")
    10.  
    11. Do While totalBuffer <> 0
    12.     strRes.Append(Encoding.ASCII.GetString(buffer,0, totalBuffer))
    13.     totalBuffer = stream.Read(buffer, 0, 128)
    14. Loop
    15.  
    16. returnString = strRes.ToString()
    17.  
    18. Return returnString
    19. End Function

  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    98
    ah much thanks, i gotta play with it a little

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Azkar
    thats C#
    In .NET , you shouldn't have any problems switching between .NET Languages since they use the same Framework and CLR . Below my sig. a tool that help you converting From/To VB.NET Code To/From C# Code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width