Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i want create a temporary download link:
This is my code:

C#
private void CreateLinkDownloadFile(string strLink)
    {
        // The file path to download.
        string filepath = strLink;//@"C:\shadow_copy.rar";
        // The file name used to save the file to the client's system..
        string filename = Path.GetFileName(filepath);
        try
        {
            System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
            response.ClearContent();
            response.Clear();
            response.ContentType = "application/octet-stream";
            response.AddHeader("Content-Disposition", "attachment; filename=" + filename + ";");
            response.TransmitFile(filepath);
            response.Flush();
            response.End();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }

and this is error message of IDM:
The web site page instead of a file when IDM requested this file second time. Probably this site uses temporary links and does not allow requesting the same address twice.
Try to delete this download, then start it again from your browser and, when IDM captures it, download it without a stop/pause.
Posted
Updated 1-May-13 5:18am
v2
Comments
ZurdoDev 1-May-13 11:30am    
So, IDM is giving you an error? What if you turn that off?
NguyenVanDuc 1-May-13 12:04pm    
the download file will not work again.
Bernhard Hiller 2-May-13 3:39am    
That's exactly the purpose of a temporary download link, isn't it? And you complain that it works as it ought to do???

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