Hello community!
I am downloading a file, which when i download it, it downloads with File name and type "Default.Aspx" instead of the expected file content.
Any ideas about the issue?
I am downloading a file, which when i download it, it downloads with File name and type "Default.Aspx" instead of the expected file content.
Any ideas about the issue?
Export method used on a normal link button:
protected void ExportFile_Click(object sender, EventArgs e)
{
var IDTemplate = (((LinkButton)sender).CommandArgument); //ID of the file in DB
var model = templatebll.GetFile(); //BLL method
if (model.FileContentT != null)
{
Response.Clear();
Response.ClearHeaders();
Response.AddHeader("Content-Type", "Application/octet-stream");
Response.AddHeader("Content-Length", model.FileContentT.Length.ToString());
Response.AddHeader("Content-Disposition", "attachment; filenameT=" + model.FileNameT + "." + model.FileTipoT);
Response.BinaryWrite(model.FileContentT);
Response.Flush();
Response.End(); //Response.Close();
}
}
Last edited: