Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

I want to create functionality to allow the user to download data..the flow is as follows

1.click download data button
2.show file names as hyperlinks to download data.
3.User clicks on file name hyperlink,then we want to send a temporary url in an email for the user to download data.

our files to download are zip files and the main reason for temporary download url is to restrict unauthorized access from remote users

I dont know how to create a temporary URL which expires after sometime, any help appreciated..thanks

regards,
Praveen
Posted

Hi there

Assuming you know how to code the file download part, I'll tell you the logic of the solution that you are looking for.

1. Create a table named "DownloadTicketsTable" which has fields "TicketNo", "Download File Name", "Date Created", "TicketLiftTime"<b></b>
2. Make a page called "dataList.aspx" in which, you list all the file names that are available for that user to download. Make sure, you don't provide the link to the exact file.
3. When the user clicks on a certain file, post the clicked file name to another page named "downloads.aspx?filename=mytest.zip" in which you create a unique ID for the download ticket (I suggest a Guid would fit very well) and make create a record in the "DownloadTicketsTable" with the other relevant field information.
4. Create links like "downloads.aspx?ticket=as4s1da23d23zwaw1" and give it to the user.
5. In the "downloads.aspx" check for the ticket id, query your table, do the time calculations.
6. If the ticket has not expired, write the file data back to the user. If it has expired, return an error message to the user "Sorry. This download ticket has expired"

Note: The names of the files, page names, GET data are just used for explaining purposes. Please, feel free to change the names, logic as fit.

Hope this helps.

Regards, Pasan.
 
Share this answer
 
v2
Comments
Joshuva Praveen 22-Mar-11 1:26am    
Thanks Pasan for your reply , i have no idea how to create a link as in your point 4 of answer and i have no idea how to write a file in to the temporary link...please provide some code if you can
CodeHawkz 22-Mar-11 3:59am    
All you have to do is google these individual things and you will get what you looking for. Give it a try.. Meanwhile, I will look to create a sample project for you, if I get some time.
You can see this
Click
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900