I need to allow the user on my site to download a file (xml File)
I tried
public FileResult DownloadFile(string fileid)
{
if (!string.IsNullOrEmpty(fileid))
{
byte[] fileBytes = Encoding.ASCII.GetBytes(FileData);
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet,FileName + ".bccx");
}
return null;
}
ajax:
function downloadFile(id) {
$.ajax({
url: sitePath + "Controller/DownloadFile?fileid=" + id,
type: 'post',
asysnc: false
})
.done(function () {
});
}
but nothing is downloaded