I need to send a file to client to be downloaded using javscript and I have found the following way to do that:
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment; filename="myflie.txt");
Response.ContentType = "text/plain";
Response.Flush();
Response.TransmitFile(filePath);
Response.End();
However I cannot get filename because it seems that this returns a raw file and calling getResponseHeader doesn't work. I'm also having trouble downloading the file itself as there is an error Resource 'blob: …' not allowed to load
. Also besides the filename I would also like to pass some other parameters as JSON and I'm unable to do that using this method. I'm a beginner when it comes to asp.net so I hope I was clear enough.