5

In some cases, a url redirects to another url while downloading an application. This we can easily identify while hitting the url in browser. But how to make this possible in code to download the application from the redirected URL using TDownLoadURL.

For example by hitting http://www.skype.com/go/getskype-full on Internet Explorer we get a redirected URL as https://download.skype.com/2292017409dc8d2781c7c2d4c1e4c1bc/SkypeSetupFull.exe

  • 3
    `TDownloadURL` is a thin wrapper for the Win32 [`URLDownloadToFile()`](https://msdn.microsoft.com/en-us/library/ms775123.aspx) function, which handles redirects for you. – Remy Lebeau Aug 24 '16 at 19:47
  • 2
    Have you seen `dsRedirecting` `StatusCode` at `OnProgress`? Location **should** appear in `StatusText`. – Free Consulting Aug 24 '16 at 22:55
  • I have added condition for StatusCode to check dsRedirecting, it is not getting into the condition and the 4 StatusCode coming as [dsProxyDetecting, dsCookieStateDowngrade, dsConnecting, dsSendingRequest], and StatusText is returning ['', www.skype.com, 23.102.255.237, '']. at the end it is coming out of download and download is failed. Could you please provide some sample code. Please let me know if I'm missing anything. thanks for comment. – Santosh Nayak Aug 25 '16 at 09:56
  • Here I found one difference. Without using "OnDownloadProgress" for TDownloadURL auto redirect of URL is handled. With "OnDownloadProgress" use for TDownloadURL its putting exception as "Invalid Enum Value". As per my requirement progress is required. As of now in other way I'm using TWebbrowser to get the redirect URL and passing the URL to TDownloadURL for download. – Santosh Nayak Sep 14 '16 at 14:52

0 Answers0