Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Highlighted
Partner
Partner

Retrieve SessionCookie using AsNtlmUserViaProxy, for the printing service

Hi Everybody,

 

I started to work with .net sdk a month ago,

now i have a problem that i can't solve, my goal is to replicate the web-browser's call on the qlik sense's printing service on the .Net SDK (.net Core),

so i need the session token on the header (for example: "Cookie:X-Qlik-Session=098d42b5-8b68-4a5f-b079-9ee569fec211").

I'm able to retrieve this token from the follow call using the the latest Qlik SDK(v13.14.0) for.Net Framework v4.5.2,

the working code:

ILocation location = Qlik.Engine.Location.FromUri(uri);
var user = "myuserid";
var pass = "mypassword";
location.AsNtlmUserViaProxy(proxyUsesSsl: uri.Scheme.Equals(Uri.UriSchemeHttps), loginCredentials: new System.Net.NetworkCredential(user, pass));
using (IHub hub = location.Hub(noVersionCheck: true))
{
String SessionCookie = location.SessionCookie;
Console.WriteLine("My session cookie is: " + SessionCookie);
//Console.WriteLine(hub.EngineVersion().ComponentVersion);
}

Now, i need this SessionCookie valorized correctly into the .NetCore v2.1 framework Environment, and using the same code above on the same version of Qlik SDK, it gave me a null value.

Someone can explain me the reason why, or suggest a solution?

 

Thank you,

Lu Quan

 

 

Labels (5)
1 Solution

Accepted Solutions
Employee
Employee

Re: Retrieve SessionCookie using AsNtlmUserViaProxy, for the printing service

Version 13.15.0 was released just now and should fix this issue:

https://www.nuget.org/packages/QlikSense.NetSDK/13.15.0

6 Replies
Employee
Employee

Re: Retrieve SessionCookie using AsNtlmUserViaProxy, for the printing service

This is a bug in the .NET Core implementation of the connection mechanism. Thank you very much for reporting this and bringing it to our attention. We will report back to this thread when there is a fix available.

A workaround for you might be to acquire the ticket up front and connect using that ticket using the AsExistingSessionViaProxy configuration. There is an example that illustrates such a flow available here:

https://github.com/AptkQlik/PublicExamples/blob/master/ConnectServerTicketAttach

The flow described in that example is based on .NET Framework 4.5.2, but a similar flow can be implemented for .NET Core.

Partner
Partner

Re: Retrieve SessionCookie using AsNtlmUserViaProxy, for the printing service

Hi @yko ,

 

I just tried the workaround, and i have the same issue. 

it works for .Net but it doesnt works for the .NetCore.

Error detail below:getCookieError.JPG

there is another workaround?

 

Regards,

Lu Quan

Employee
Employee

Re: Retrieve SessionCookie using AsNtlmUserViaProxy, for the printing service

I think the credential part of HttpClientHandler is handled differently in .NET Core compared to .NET Framework. You need to explicitly set it. You can see an example here:

https://github.com/kolsrud/qlik_rest_sdk/blob/master/Qlik.Sense.RestClient/RestClient.cs#L120

Employee
Employee

Re: Retrieve SessionCookie using AsNtlmUserViaProxy, for the printing service

Version 13.15.0 was released just now and should fix this issue:

https://www.nuget.org/packages/QlikSense.NetSDK/13.15.0

Partner
Partner

Re: Retrieve SessionCookie using AsNtlmUserViaProxy, for the printing service

thanks, it works 😉
Employee
Employee

Re: Retrieve SessionCookie using AsNtlmUserViaProxy, for the printing service

Good! I'm happy to hear that. And thanks again for providing the feedback. Input like this from the community is very valuable for getting the .NET Core version of the SDK to a quality that will allow us to move it out of experimental status.