I have MVC.NET 2.0 project. It allows clients to download files which are stored on server. I use FileContentResult class for these purposes. How do 开发者_JAVA技巧I can add limitation of maximum downloading speed for unregistered users?
This is something you would probably want to accomplish using IIS's Bit Rate Throttling rather than coding it yourself. No need to re-invent the wheel. IIS is also more flexible, easy to change on the fly, and is robust.
There is not automagic way to accomplish this. You will have to take control of the response stream and throttle it. As a quick example, you can look at this URI (notice it is not necessarily THE answer to your problem, but an example): http://www.codeproject.com/KB/IP/Bandwidth_throttling.aspx
Translated, this means is you are not going to solve this through MVC alone.
精彩评论