Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2003, 02:24 PM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default File size on customer side

Hi all,
I'm looking for a solution for the following problem.

A customer logs in to the webserver and see a list with requested file where he payed for. Once the download was sucesfull he cannot download the file a 2th time.

Any idea how to solve this practical ?

Thanks,
Vincent


 
Old August 25th, 2003, 03:36 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

This is a tough one for a couple reasons. I don't know if there is a reliable way to provide only single access thru client-side code. If the person refreshed the page, they would be able to "reset" the lockout. Normally, this kind of thing would be accomplished by keeping track of when the file has been downloaded on the server side. Usually, you'd provide a link to a page that returned a binary stream of the desired file instead of providing a link directly to the file. (a direct link would of course not secure it from being downloaded twice.) However, one then encounters the issue of a failed download. If you mark the file as "downloaded for user x" and their download breaks halfway thru then you have a problem. Not sure how people solve this issue. Perhaps someone else has a suggestion.

Peter
 
Old August 25th, 2003, 04:16 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I posted a suggestion in another forum, suggesting to stream the file as well, after the database has been checked for sufficient permissions to download it again.

One solution to overcome the failed download is to set a flag in the database after the file has been completed. I think the BinaryWrite method (which you use to stream the file) is a blocking call; that is, the function will be performed on the main thread, blocking other code following it. If the line directly after the BinaryWrite performs a database update, you can be pretty sure that once you do the update, you have a valid download.

(See Vincent, cross-posting causes more problems than it solves. Now the questions and answers are all over the place, forcing everyone to follow a couple of threads and do cross-referencing all the time.... ;))

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Verifying uploaded File Size in Client-side Ushhh ASP.NET 1.0 and 1.1 Professional 5 August 30th, 2006 07:13 AM
How to check file size on customer side vincentvdm Classic ASP Professional 3 August 27th, 2003 12:23 AM
File size on client side vincentvdm Classic ASP Basics 0 August 25th, 2003 02:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.