DownloadStarting Event  
 

The DownloadStarting event occurs when a file download is starting, allowing the application to cancel the download if needed.

Syntax

Sub object_DownloadStarting ( [Index As Integer,] ByVal FileUrl As String, FileName As String, Cancel As Boolean )

Remarks

This event occurs when a file download is initiated either by a user clicking on a link or navigating to a URL which specifies content that cannot be rendered in the browser and the FileUrl argument specifies the URL for the file being downloaded, the FileName argument is the path to the local file that will be created. The local file name is passed by reference to the event and can be changed in the event to specify a different file path and/or name if needed.

To prevent the file from being downloaded, set the Cancel argument to True inside the event handler. If the download is canceled, the browser will not show the normal progress dialog in the upper-right corner of the control window.

See Also

DownloadCompleted Event