asp.net文件下载 - 下载追踪大小 [英] asp.net file downloading - track downloaded size

查看:133
本文介绍了asp.net文件下载 - 下载追踪大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设计一个系统,这样的事情有ASP.net/C#。

I am trying to design a system for something like this with ASP.net/C#.

在用户付费下载一些内容(文件 - 的MP3 / PDF文件,DOC等)。我应该能够跟踪用户下载的字节数。如果字节数下载匹配的字节数在服务器上,我应该设置在DB(,告诉下载成功和$ P $再次下载该文件再次pvent他们/要求他们支付下载)标志。如果下载是不完整的,他们应该能够再次下载该文件,而无需再次支付它(因为该标志不会被设置)。

The users pay for downloading some content (files- mp3s/PDFs,doc etc).I should be able to track the number of bytes downloaded by the user. If the number of bytes downloaded match the number of bytes on the server, I should set a flag in DB (telling that the download was successful and prevent them from downloading the file again/asking them to pay for the download again). If the download was incomplete, they should be able to download the file again without paying for it again(since the flag will not be set).

有什么办法来跟踪客户端成功下载?字节数

Is there any way to keep track of the number of bytes successfully downloaded by the client ?

此外,当我看到我的WinXP机器上的文件大小,我看到两个尺寸(大小,磁盘大小)。我应该考虑哪一个?并且将其从一个操作系统的不同而不同?

Also when I see a file size in my WinXP machine, I see two sizes(size,size on disk). Which one should I consider ? And will it differ from one OS to another ?

推荐答案

您可以创建一个服务于文件(asp.net mvc的ü可以做一个动作的结果,而不是一个asp.net处理......这就是我中号使用)。请确保它支持断点续传下载。

you can create an asp.net handler that serves the file ( for asp.net mvc u can do a result action instead ... this is what I'm using). Make sure it supports resumable downloads.

从可以跟踪字节服务。

诗。这导致性能开销与让IIS服务它

Ps. this incurs a performance overhead vs. letting IIS serve it

更新1:我使用类似于此<东西pretty A HREF =htt​​p://dotnetslackers.com/articles/aspnet/Range-Specific-Requests-in-ASP- NET.aspx相对=nofollow> http://dotnetslackers.com/articles/aspnet/Range-Specific-Requests-in-ASP-NET.aspx ...和文章有$ p $在它里面有什么ptty明确的解释。你或许可以用一个原样,请在该职位的例子。

update 1: I used something pretty similar to this http://dotnetslackers.com/articles/aspnet/Range-Specific-Requests-in-ASP-NET.aspx ... and the article has a pretty clear explanation on what's inside it. You probably can use that one as is, see the example in that post.

这篇关于asp.net文件下载 - 下载追踪大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆