Wrox Programmer Forums
|
ASP E-commerce As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP E-commerce 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:18 PM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default File size on client 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: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

Hi there,

Can you please not double (or triple or quadra) post your messages? Posting them in one forum usually gives it enough exposure.

Secondly, is the subject incorrect, or the question? They don't seem to match.

Anyway, the easiest way to do this is to use a database. Give each customer a unique idea. As soon as they log in, store this name somewhere (cookie, session, whatever). Before you display the list with files, check whether they have already download the file before. If they have, block the access.

Now, to prevent users from directly requesting the same file again, without going through your file list page, here's the trick:

1. Don't allow direct files; that is, don't store files under your wwwroot folder, but under c:\Documents for example.
2. Provide a general download page (download.asp for example) that takes the ID of the download.
3. In download.asp, implement the following pseudo code:

Code:
If ID is valid
  If Customer has downloaded file before
     Response.Write ("Sorry")
  Else
     Get file from file system and stream it to the browser
  End If
End If
Check here or here for more info on how to push the file to the client.


HtH,


Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 26th, 2003, 01:26 PM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar and all others,

the problem is not the download but the confirmation that the download has been done succesfull or not!

Thanks,
Vincent

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

Hi Vincent,

I posted an answer about that here. Would that help?

In short, once the first line after BinaryWrite executes, the download is complete. Wouldn't it be possible to do a Response.Clear and then redirect the user to a confirmation page? Haven't checked it, and doubt that it works (the HTTP headers already being sent, etc). but it might be worth trying....


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 customer side vincentvdm Javascript How-To 2 August 25th, 2003 04:16 PM
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.