I am planning to sell digital goods on my website (Asp.net). After successful payment the customer 开发者_开发技巧will be redirected to the download page of my website, which will display the link to download the digital content stored in my server.
I want to secure the location of the file, by creating a disposable link to the file. Every time a customer visits this page a new download link will be generated for the same file. Also this link should expire after it is downloaded for the first time.
Is it possible to do it in asp.net ( C# preferably )? if yes how can i do it?
If you want to the Link itself and not the query string to expire you will need to us MVC or at the very least URL routing in .NET. Then you will need to do the following:
- Create a table with the expiring URL (generate with using time or GUID generator), createdate & time, and how long before it expires.
- When a user clicks the link it will check in the RouteHandler for a row existing in the table. If the row exists and the createdate & time + expiration time is still greater than current time then show them the page. Otherwise redirect them to whatever page you want.
Yes it is possible. One way would be to use handler (.ashx) files.
精彩评论