Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET Link Download
Hi,
 
Greetings!!
 
Are there any solution to disable an download link ( auto generate and enable only in 2 hours).
So public users can not download my upload file.
 
It's very kind of you for discussing with me.
Thanks !
Posted 31-Oct-12 3:30am
Comments
ProgramFOX at 31-Oct-12 8:34am
   
What's the root website of the download link?
snehasish nandy at 31-Oct-12 8:35am
   
Pls provide some more information about your requirement...
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

One way to do this could be:
 
1. have the link created for the file to be downloaded.
2. Get the current time-stamp of server encrypt it and put it in the querystring of download link.
3. whenever someone visit decrypt the qurystring and check with current time.
4. if time elapsed is less then 2 hours let him see the page.
5. if not push him to error page.
  Permalink  
Comments
Marcus Kramer at 31-Oct-12 9:16am
   
+5. A very good solution.
Rahul Rajat Singh at 31-Oct-12 11:39am
   
And the reason i choose this kind of solution is that there is no db needed to keep track of stale n fresh links. I.e. All the state of the link is in the link itself.
NguyenVanDuc at 1-Nov-12 12:59pm
   
My link was generate only for an customer, nobody else can using this link for saving the download file. And this link is available in 2 hours.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

1) You can add following tag in head of aspx page where (content="5") 5 is second of the interval for refreshing the page.
    <meta http-equiv="refresh" content="5">
   so in your case (2*3600) makes 2 hours refresh.
2) If you are adding download link dynamically so on each refresh toggle by viewstate variable and do remove/add of the hyperlink(<a> </a>) part so downloads gets restricted/allowed.
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 525
1 Maciej Los 319
2 BillWoodruff 174
3 Suraj Sahoo | Coding Passion 170
4 /\jmot 152
0 OriginalGriff 8,654
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,229
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 31 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100