We suspect that you are using the PDF viewer control to show the PDF documents. "HttpClient" can be used to load the PDF using the URL.
private async Task<Stream> DownloadPdfStream(string URL)
HttpClient httpClient = new HttpClient();
HttpResponseMessage response = await httpClient.GetAsync(URL);
//Check whether redirection is needed
if ((int)response.StatusCode == 302)
//The URL to redirect is in the header location of the response message
HttpResponseMessage redirectedResponse = await httpClient.GetAsync(response.Headers.Location.AbsoluteUri);
return await redirectedResponse.Content.ReadAsStreamAsync();
return await response.Content.ReadAsStreamAsync();
We've attached a sample of how to load a PDF using a URL. We have used a PDF link for illustration purpose in the sample. Please use the sample with your own link. Please let us know whether the sample and code snippet meets your requirement.
Attachment:
SimpleSample_b282f500.zip