1
I need to make a Javascript method that calls an ashx (Generic Handler) that returns an array of bytes (a file). This file can be XML, TXT or PDF. So far I solved the problem, but when the file does not exist, I am redirected to another page, but I just want to display an Alert with the error message.
function GetFile(idAction, chave, fileType) {
window.downloadfile = function (e) {
window.location = "MyHandler.ashx?parameter1="
+ idAction + "¶meter2=" + fileType + "¶meter3=" + chave;
}
downloadfile();
}