javascript - How to call rest service for responseType = "arraybuffer" using (.net) HttpWebRequest object? -


how can call rest service in .net responsetype = "arraybuffer".

i able response in javascript using below code.

var req = new xmlhttprequest(); req.open("get",url, true); req.setrequestheader("accept", "application/json; odata=verbose");  req.onreadystatechange = function () {     if (this.readystate === 4) {         debugger;         this.onreadystatechange = null;         if (this.status === 200) {           var blob = new blob([this.response], {type: "octet/stream"});           var reader = new window.filereader();           reader.readasdataurl(blob);            reader.onloadend = function() {             base64data = reader.result;                             console.log(base64data);           }           var filename = "sample.pdf";           savebytearray(blob, filename);         }     } }; req.responsetype = "arraybuffer"; req.send(); 

same call want call .net (httpwebrequest) application.

note: calling share point rest service.

i want convert response octet/stream -> array buffer -> base64 -> email file attachment dynamic crm plugin


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -