Create temporary link for download
I use ASP.NET I need to give user temporary link for downloading file from server. It should be a temporary link (page), which is available for a short time (12 hours for example). How can I generate this link (or temporary web page with link)? Here's a reasonably complete example. First a function to create a short hex string using a secret salt plus an expiry time: public static string MakeExpiryHash(DateTime expiry) { const string salt = "some random bytes"; byte[] bytes = Encoding.UTF8.GetBytes(salt + expiry.ToString("s")); using (var sha = System.Security.Cryptography.SHA1.Create())