2

I'm implementing a .Net 4.6.2 c# Web application which needs to access the V2.0 SSRS RestAPI and I want to complete Authentication using a a standard way of passing my credentials.

The question is answered here How to call SSRS Rest-Api V1.0 with custom security implemented (NOT SOAP) however this uses Form based interface intended for Browser use, and therefore is not a standard way of authenticating a client application. The SSRS RestAPI is documented on Swaggerhub ( https://app.swaggerhub.com/apis/microsoft-rs/SSRS/2.0#/Session/CreateSession ) and provides an explicit SESSION path which will complete Authentication with body content passed with a HTTP Post. That works, and will solve my problem, however I keep seeing code such as below on Stackoverflow (e.g How to authenticate with Rest-client based on HttpClient and .net4 ) and elsewhere and wonder is there some conventional technique utilising either HttpClient/HttpClientHadler/WebRequestHandler which will transmit my credentials in a widely recognised manner.

var credentials = new NetworkCredential(userName, password);
var handler = new HttpClientHandler { Credentials = credentials };

using (var http = new HttpClient(handler))
{
    // ...
}

I'm expecting that once Authenticated I will simply have to ensure the Cookie(s) returned are recycled on subsequent requests within this session.

Mike
  • 101
  • 1
  • 5
  • See following : https://github.com/microsoft/Reporting-Services/tree/master/CustomSecuritySample – jdweng Jul 11 '19 at 16:22
  • 1
    Tx @jdweng. I've got a working custom security extension on the server. I'm looking to see if the SSRS Web Portal supports a more elegant / standard way of passing in the credentials than the SESSION Url with JSON body content. – Mike Jul 11 '19 at 22:42

0 Answers0