ASP.NET downloads a file directly instead of opening it in IE

xiaoxiao2021-03-06  107

Sometimes we don't want users to open known types of files directly in IE, such as Word, and hope to download directly, at this time, the following code can be used to replace Response.Redirect response.conteTtype = "Application / OcT-stream"; response .Addic-dispositioner, "attachment; filename =" YourFileName); response.binaryWrite ((byte []) YourFileData.Rows [0] ["attachment"]); response.end (); Hello.chm This is the name of Hello.chm when the client is downloaded.


New Post(0)