This is a migrated thread and some comments may be shown as answers.

download file from rad grid control

1 Answer 275 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ravi
Top achievements
Rank 1
Ravi asked on 31 Jul 2014, 09:43 AM
how to download files to a specified client folder from server without showing open/save promptin asp.net application?




if (e.CommandName == "download_file")        {            string filename=e.CommandArgument.ToString();            string path=MapPath("~/files/" + filename);            byte []bts=System.IO.File.ReadAllBytes(path);            Response.Clear();            Response.ClearHeaders();            Response.AddHeader("Content-Type", "Application/octet-stream");            Response.AddHeader("Content-Length",bts.Length.ToString());            Response.AddHeader("Content-Disposition","attachment; filename=" + filename);            Response.BinaryWrite(bts);            Response.Flush();            Response.End();        }




1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 05 Aug 2014, 06:55 AM
Hello Ravi,

Generally when the Content-Disposition is set to attachment you should always get a prompt asking the user whether to allow the file to be downloaded. However you can try workarounding the behavior by following the suggestions from the below provided resources.
Additionally please note that the problem is not directly related to our controls and is more a general programming issue. That said I recommend researching the MSDN forums for possible alternative solutions.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Ravi
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or