asp.net VB.net file download handler not work properly

后端 未结 1 633
别那么骄傲
别那么骄傲 2021-01-25 08:22

I have big file (about 2GB) to distribute to our customer, My website is written by asp.net vb, this is my file download handler:

Public Class FileHandler
    Im         


        
相关标签:
1条回答
  • 2021-01-25 08:51

    I use a button or just a plain link to the file itself, I've never had to use a handler to download files.

    For example, on the aspx I have a button and in the code behind I send the user to the file using the response object:

    Protected Sub Button_DownloadFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_DownloadFile.Click
    
        Response.AddHeader("Content-Disposition", "attachment; filename=TheFileName.ext")
        Response.WriteFile("~/App_Data/TheFileName.ext")
    
    END SUB
    
    0 讨论(0)
提交回复
热议问题