SSRS Report authentication in Razor View

Viewed 42

I have one SSRS report which can be accessible to group of people who are part of one azure active directory group. I used below logic to retrieve the report from the server. I'm getting 200 response with some content. But, not getting actual data from the SSRS report. Could anyone please help me to authenticate the SSRS report from Website/Razor/Blazor page.

'``` using (var client = new HttpClient()) {

            String url = $"<<reportURL here>>";
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new
              System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

            var byteArray = Encoding.ASCII.GetBytes(@"<<SGUserName>>:<<SGPassword>>");

            client.DefaultRequestHeaders.Authorization = new
               System.Net.Http.Headers.AuthenticationHeaderValue("Basic",
               Convert.ToBase64String(byteArray));

            var httpResponse = await client.GetAsync(url);
            if (httpResponse.IsSuccessStatusCode)
            {
                //reportBaseUrl = await httpResponse.Content.ReadAsStringAsync();
                htmlContent = await httpResponse.Content.ReadAsStringAsync();
                
            }
        }
0 Answers
Related