Example in WebFile.Download will be 404 errors.

I tried to make a download button by a web application.
I used an example in the document, but it was an error.
Can the said problem be settled?

Running the cord

  Dim TextFile As New WebFile
  TextFile.ForceDownload = True
  TextFile.MimeType = "text/plain"
  TextFile.FileName = "TextFile.txt"
  TextFile.Data = "Hello, world!"
  print(Str( TextFile.Download( ) ))  ' > True
  'ShowURL(TextFile.URL) ' <- The result is same.

Result page

404: File Not Found
The requested URL "/EFB745F6175A51ADBD49FF93E29448848129FB02/files/2346-6200-6779-4130-5300/TextFile.txt" could not be found. Please check your request and try again.
Remote Address: 127.0.0.1

please make the web file a property of a webpage, so it stays alive long enough.

In your code the web file is released on the end of the method (local variable) and a millisecond later when browser asks for it, it’s gone.

Hello Christian, Thank you very much for your reply.

But this application is the web stand alone type.
What kind of setting is possible concretely?

I have pressed a Answer button by mistake.

I can’t settle it.

add a property to the webpage where this code is.

name: textFile
type: webfile

now remove in your code the line

Dim TextFile As New WebFile

and write

TextFile = New WebFile

in total:

TextFile = New WebFile TextFile.ForceDownload = True TextFile.MimeType = "text/plain" TextFile.FileName = "TextFile.txt" TextFile.Data = "Hello, world!" call TextFile.Download( )

Thank you very much for Christian,
I made a mistake in reading the meaning, the thing was just understood.
It’s a lifetime of an object, isn’t it?
Thank you very much for your kind explanation to my simple mistake.

I’m not good at English, so misreading occurs.
Sample code is the common language of all nations which could be understood by a look. (^o^;;;