Visual InterDev: Logging File Download

Visual InterDev: Logging File Download

Sometimes it is useful to keep track of users’ file download activity on your site. When a user clicks on a hyperlink to download a file, you can run an ASP page on the server to log something into SQL Server and then download the file into the client. The trick is to use a hyperlink to launch a second “background” script that logs the filename and initiates the download. If the second script doesn’t produce any HTML output, the first page stays on the user’s browser screen.

Here’s how the hyperlink looks in the first file:

 Download code.zip

When the user clicks the hyperlink, we pass the requested filename to the second file,dnladd.asp. Dnladd.asp contains the script and SQL commands that write the filename and other information to the database. After that, dnladd.asp initiates the download withthese lines:

 Response.ContentType = "application/x-zip-compressed" Response.Redirect request("filename")

Remember: don’t put any HTML code in dnladd.asp.

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular