Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
LuQuan182
Partner - Contributor II
Partner - Contributor II

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
Øystein_Kolsrud
Employee
Employee

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

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

View solution in original post

6 Replies
Øystein_Kolsrud
Employee
Employee

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.

LuQuan182
Partner - Contributor II
Partner - Contributor II
Author

Hi @Øystein_Kolsrud ,

 

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

Øystein_Kolsrud
Employee
Employee

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

Øystein_Kolsrud
Employee
Employee

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

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

LuQuan182
Partner - Contributor II
Partner - Contributor II
Author

thanks, it works 😉
Øystein_Kolsrud
Employee
Employee

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.