Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. RE: URLdownloadToFile

RE: URLdownloadToFile

Scheduled Pinned Locked Moved Visual Basic
helpcsharphtmlcomjson
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rmurali
    wrote on last edited by
    #1

    Anybody had this problem before. I am trying to download a webpage using the URLDownloadToFileA API decalred in urlmon from VB .net and it is not downloading and the returns long value. I tried to trnslate the error code "underlaying portocol is unknown" Declare Function URLDownloadToFile Lib "urlmon" Alias _ "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal _ szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long src as string, dest as string lResult as long src = "http:\\www.msn.com" dest = "c:\images\x.html" lResult = URLDownloadToFile(0, src, dest, 0, 0) but the same code works very well in VB 6.0. I can download pages with out a problem. any help appricated. -Murali

    J 1 Reply Last reply
    0
    • R rmurali

      Anybody had this problem before. I am trying to download a webpage using the URLDownloadToFileA API decalred in urlmon from VB .net and it is not downloading and the returns long value. I tried to trnslate the error code "underlaying portocol is unknown" Declare Function URLDownloadToFile Lib "urlmon" Alias _ "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal _ szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long src as string, dest as string lResult as long src = "http:\\www.msn.com" dest = "c:\images\x.html" lResult = URLDownloadToFile(0, src, dest, 0, 0) but the same code works very well in VB 6.0. I can download pages with out a problem. any help appricated. -Murali

      J Offline
      J Offline
      John Kuhn
      wrote on last edited by
      #2

      How about using the .NET framework WebRequest and Stream to read the data from the URL, then use a FileStream to write it out to a file? There's and example of the read step on GotDotNet, http://samples.gotdotnet.com/quickstart/howto/doc/WebRequests/clientGET.aspx And as for writing it to a file, the .NET library sample: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemIOFileStreamClassTopic.asp

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups