Post by Roger Cabo on Apr 26, 2024 19:09:03 GMT 1
Hi everyone,
I'm happy to get a HTTPS asynchron download with .Net 4.8 DLL unter GB32 to work!
Not completely finished jet!
Did you have further ideas?
Please comment!
What This DLL Program Does:
Imagine you have a tool that helps you download files from the internet automatically.
This tool is called "WebHelper" , and it works like a helpful robot that can fetch (up and download by HTTPS) files for you
when you tell it where to look on the Web and what the file is named.
Downloading a File When You Don't Know the Name:
Eg:
Fetching the File:
If you want to download a file but you don't know what it's called, WebHelper will still try to get it for you. It goes to the website address (URL) you gave it and asks for the file.
Finding the File's Name: Sometimes, the website will tell WebHelper the name of the file through something called a 'Content-Disposition header'. It's like a note that comes with the file saying, "Hey, when you save this file, call it this name!"
Checking the Name:
WebHelper makes sure the name is okay to use. It checks that the name doesn't have any weird or bad characters that could cause problems on your computer.
What Happens to PHP Scripts:
Sometimes, the file you want comes from a PHP script. PHP is a way to make websites do cool and dynamic stuff, like creating files on the fly based on what you ask for.
PHP Sets the File Name:
If the PHP script is sending you a file, it can suggest a name for the file by using the same kind of note (Content-Disposition header) mentioned before.
Downloading the File:
Once WebHelper knows the file's name and checks that it's a good name, it goes ahead and saves the file to your computer in a special folder. It makes sure not to save it somewhere it shouldn't go!
What the Tool Tells You:
WebHelper can also tell you how things are going:
Is it done yet? You can ask if the file has finished downloading.
Did something go wrong? If something didn't work right, WebHelper can tell you what the problem was.
Where did it save the file? It can show you where the file got saved on your computer.
What are Tokens?
Tokens are like secure keys used during communications between two parties, usually over the internet. They help in verifying the identity of the person or system making a request, such as downloading a file. The server that provides the file can check this token to ensure it’s being given to the right person.
How Tokens Work!
Token Generation: When you log into a website or app, the server gives you a token. This token is generated based on some unique details, like your user ID or session data.
Token Use: You send this token back to the server each time you request something, like when you want to download a file.
Token Verification: The server checks the token to make sure it’s valid and if it matches, it allows the download to happen.
Why Use Tokens?
Security: Tokens can secure the transaction and ensure both parties are who they say they are.
Simplicity: Tokens are easy to handle and pass around with requests in a network.
Control: Servers can easily control and track who accesses what data based on tokens.
I'm happy to get a HTTPS asynchron download with .Net 4.8 DLL unter GB32 to work!
Not completely finished jet!
Did you have further ideas?
Please comment!
What This DLL Program Does:
Imagine you have a tool that helps you download files from the internet automatically.
This tool is called "WebHelper" , and it works like a helpful robot that can fetch (up and download by HTTPS) files for you
when you tell it where to look on the Web and what the file is named.
Downloading a File When You Don't Know the Name:
Eg:
Dim url$ = "https://via.placeholder.com/150"
Fetching the File:
If you want to download a file but you don't know what it's called, WebHelper will still try to get it for you. It goes to the website address (URL) you gave it and asks for the file.
Finding the File's Name: Sometimes, the website will tell WebHelper the name of the file through something called a 'Content-Disposition header'. It's like a note that comes with the file saying, "Hey, when you save this file, call it this name!"
Checking the Name:
WebHelper makes sure the name is okay to use. It checks that the name doesn't have any weird or bad characters that could cause problems on your computer.
What Happens to PHP Scripts:
Sometimes, the file you want comes from a PHP script. PHP is a way to make websites do cool and dynamic stuff, like creating files on the fly based on what you ask for.
PHP Sets the File Name:
If the PHP script is sending you a file, it can suggest a name for the file by using the same kind of note (Content-Disposition header) mentioned before.
Downloading the File:
Once WebHelper knows the file's name and checks that it's a good name, it goes ahead and saves the file to your computer in a special folder. It makes sure not to save it somewhere it shouldn't go!
What the Tool Tells You:
WebHelper can also tell you how things are going:
Is it done yet? You can ask if the file has finished downloading.
Did something go wrong? If something didn't work right, WebHelper can tell you what the problem was.
Where did it save the file? It can show you where the file got saved on your computer.
1. StartHTTPSFileDownload(string url, string fileName, int maxData, string Token)
Function: Initiates the download of a file from the specified URL.
Parameters:
url: The web address from which the file is to be downloaded.
fileName: The desired name for the downloaded file. If this is empty, the name will be extracted from the response's content disposition.
maxData: The maximum amount of data to download, specified in bytes.
Token: See below
2. GetDownloadStatus()
Function: Checks the completion status of the file download.
Returns: An integer indicating the status:
0 indicates that the download is still in progress.
100 indicates that the download is complete.
Negative values indicate various errors (e.g., -1 for HTTP errors, -5 for invalid filename).
3. GetTempFilePath()
Function: Retrieves the temporary file path where the downloaded file is stored.
Returns: A string containing the path to the downloaded file.
4. GetErrorMessage()
Function: Provides any error message that might have been generated during the file download process.
Returns: A string with the error message, if any.
5. ReturnMaxData(int maxData)
Function: Simply returns the maximum data limit that was passed as an argument. This can be used for confirmation or logging purposes.
Parameters:
maxData: The maximum data amount that was originally specified for download.
Returns: The same maxData value that was input.
Token:
Function: Initiates the download of a file from the specified URL.
Parameters:
url: The web address from which the file is to be downloaded.
fileName: The desired name for the downloaded file. If this is empty, the name will be extracted from the response's content disposition.
maxData: The maximum amount of data to download, specified in bytes.
Token: See below
2. GetDownloadStatus()
Function: Checks the completion status of the file download.
Returns: An integer indicating the status:
0 indicates that the download is still in progress.
100 indicates that the download is complete.
Negative values indicate various errors (e.g., -1 for HTTP errors, -5 for invalid filename).
3. GetTempFilePath()
Function: Retrieves the temporary file path where the downloaded file is stored.
Returns: A string containing the path to the downloaded file.
4. GetErrorMessage()
Function: Provides any error message that might have been generated during the file download process.
Returns: A string with the error message, if any.
5. ReturnMaxData(int maxData)
Function: Simply returns the maximum data limit that was passed as an argument. This can be used for confirmation or logging purposes.
Parameters:
maxData: The maximum data amount that was originally specified for download.
Returns: The same maxData value that was input.
Token:
What are Tokens?
Tokens are like secure keys used during communications between two parties, usually over the internet. They help in verifying the identity of the person or system making a request, such as downloading a file. The server that provides the file can check this token to ensure it’s being given to the right person.
How Tokens Work!
Token Generation: When you log into a website or app, the server gives you a token. This token is generated based on some unique details, like your user ID or session data.
Token Use: You send this token back to the server each time you request something, like when you want to download a file.
Token Verification: The server checks the token to make sure it’s valid and if it matches, it allows the download to happen.
Why Use Tokens?
Security: Tokens can secure the transaction and ensure both parties are who they say they are.
Simplicity: Tokens are easy to handle and pass around with requests in a network.
Control: Servers can easily control and track who accesses what data based on tokens.