Forcing Download in HandleURL

From within a session I know it’s possible to force download like this:

[code] DIM p AS NEW Picture(100, 100)
DIM g AS Graphics

g = p.Graphics

g.FillRect 0, 0, 100, 100

MyWebPicture = p //A property
MyWebPicture.ForceDownload = TRUE

ShowURL(MyWebPicture.URL)[/code]

But I need to force the download from a completely unrelated session, using a HandleURL.

The following code in HandleURL shows the file, but I would like it to be downloaded instead of loaded in the browser.

//Code below shows picture in browser Request.MIMEType = "Image/jpeg" mypic.UseCompression=false dim bsReply as new BinaryStream(myPic.Data) request.Print bsReply.read(bsReply.Length) ]

Any suggestions if this can be done?

Sometimes asking the question is answering it :slight_smile:
The following code in HandleURL downloads the file instead of showing it in the browser, also maintaining the filename.

    
    dim thefile as folderItem = localfile  // which in this case is a jpg
    Request.File = thefile
    Request.Header("Content-Type") = "Image/jpeg"