I have referred to the below thread to develop file download with Ajax.
The steps are as below:
- Click Download button on default.aspx page which is in an Ajax Panel (RadAjaxPanel1)
- Download Button Even fires
3. Logic in Download.aspx.cs page processes and user is prompted to Open, Save, Cancel file download.
FileInfo fileInfo = new FileInfo(filepath);
HttpContext.Current.Response.AddHeader("Content- Disposition", "attachment; filename=" + fileInfo.Name);
HttpContext.Current.Response.ContentType = "application/octet-stream";
The download function is working fine. However, Page is just reloaded instead of download for the first time due to IE download security block.
This can be solved by follow setting as below:
IE Tools -> Internet Options -> Security -> Internet -> Custom Level ->Downloads (Automatic prompting for file downloads) ->Enable.
Unfortunately, the above setting is not a good option. May I know is there any solution to solve the above issue by coding?