Reputation: 2618
I need very advanced and effective method of Preventing Users from Downloading file from website directly in asp.net.
Method should -
limit downloads, limit time, limit requests, etc.
but should be downloadable by active login users
Upvotes: 1
Views: 528
Reputation: 4232
Store the files in a folder which is not accessible via IIS (i.e., not underneath your web application's root)
Create an .ashx generic handler which takes a file identifier (either filename, or ID of some sort) as a QueryString parameter.
In that .ashx, perform whatever checks you want to perform: is the user logged in? have they downloaded too many files? etc.
Then, if you decide that they should be allowed to download it, set the response headers appropriately and write the file out to Response.OutputStream
Upvotes: 1
Reputation: 1177
You can put your files into a directory and configure that directory as not accessible by public users.
Upvotes: 2
Reputation: 499392
Delete the file from the server.
Any user trying to download it will not longer succeed.
Upvotes: 2