I am trying to save a file to the client's machine. I want to require the client to pick the location of the download.
I have endpoint of the REST service which returns the file to be downloaded. I am trying to set up the code to download the file thats returned from the service with save as dialog.
var Url = "https://randomaddresss/v5/invoices/{" + InvoicesId + "}/getpdfbyid"; HttpResponse response = HttpContext.Current.Response; response.ClearContent(); response.Clear(); response.ContentType = "application/pdf"; response.AddHeader("Content-Disposition", "attachment; filename=" + InvoicesId + ".pdf;"); response.TransmitFile(Url); response.Flush(); response.End(); The error thats returned is on the line response.TransmitFile(Url); :
'https:/randomaddresss/v5/invoices/2131231231231312/getpdfbyid' is not a valid virtual path.