I have a javascript function from which I need to call a controller action to return the filestream to the UI . I am not getting the open,save and save as dialog box. In the cshtml file I have following function:DownloadFile
var selectUrl = '@Url.Action("Download", "Controller")' + "/" + filedetails;
$.post(selectUrl);
and in the controller I have the following code:
public ActionResult Download(string id)
return File(downloadStream, "application/octet-stream",fileName);
Please let me know is this the correct way of calling.
var selectUrl = '@Url.Action("Download", "Controller", new {id=filedetails})'and tell me if it works. Apparently, you are not going to the correct url. Put a debug pointer in your Download Action to see if your request reach there.