HI Jerryzy,
Thank you for the update. Can you provide me your thoughts that I want to open the SharePoint documents in browser from other/independent applications without credentials prompt? I have only documents URL in independent application/ Programmatically I want to authenticate the URL and open the document without download or stream. Download and streams will take time for large files when multiple users access the same url.
Is there any in Built Web APIs provided by Microsoft to access the documents URL programmatically without download?
Please advise me. Is the below code appropriate for my need? I am directly getting the stream from HttpResponse without looping.
HttpWebRequest request;
request = (HttpWebRequest)WebRequest.Create(strFileUrl); // SharePoint document URL
request.Timeout = 600000000;
request.CookieContainer = new CookieContainer();
request.CookieContainer.Add(cookie); // Authentication using cookie
request.AllowWriteStreamBuffering = false;
byte[] read = null;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream str = response.GetResponseStream();
MemoryStream ms = new MemoryStream();
str .CopyTo(ms);
read = ms.ToArray();
Please provide your thoughts.