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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -