I want to limit user from downloading the second file if his first file download not finished yet, My approach is to insert a record for downloading file on database with finished attribute equal to false; when download finished I change the finished = true; so the user will able to download another file. for knowing if download finished I created a class named ControlledFileStreamResult derived from FileStreamResult. and a Filter that implements IResultFilter. in this Filter; I implement the OnResultExecuted in a way that control the property values in ControlledFileStreamResult and if DownloadCompleted == true then update database and set finished = true; or if DownloadCanceled == true then remove the record from db.
This approach work well until the user uses Internet Download Manager and similar download manager programs to download the file; OnResultExecuted cannot catch if download canceled. and also when these type of programs used the request sent multiple time so I cannot manage to removing the record from db or set finished=true if download successfully completed.