Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
lavanyaravilla
Contributor
Contributor

How to connect to qlik sense with windows authentication from ilocation object in .net web application

Hi,

I am new to qlik sense ..got on erequirement to integrate qlik sense sheet objects in .net application.

For that i have installed qlik sense .net SDK via nuget.

But i am able to connect via only below statement

location.AsNtlmUserViaProxy(certificateValidation: false)

but its connecting when i provide networkcredentials like hardcoded username and password

location.AsNtlmUserViaProxy(proxyUsesSsl: false, loginCredentials: new NetworkCredential("xx", "xxx", "xx"));

  But user specific sheets i have to get and bind to dropdown which not posible with above statement.

Please help in getting other way to connect to qlik sense  with example.

Thank you

5 Replies
Øystein_Kolsrud
Employee
Employee

Do you mean that it is not connecting when you use the credential version? What error message do you get in that case? I see you do not set the "certificateValidation" flag in that call. Is that by intent?

By the way, there are multiple examples on how to set up connections available here:

https://github.com/AptkQlik/PublicExamples

lavanyaravilla
Contributor
Contributor
Author

Thanks for your reply .

Its connecting when i use the credentials hardcoded, but i cannot send the credential with one specific user . This functionality should work with logged in user with windows authentication and 'NetworkService' as pool identity.

when i try to connect with user directory as

  location.AsDirectConnection(userDirectory: "xx", userId: "sdfhdg", extendedSecurityEnvironment: false);

An exception of type 'Qlik.Sense.JsonRpc.CommunicationErrorException' occurred in Qlik.Engine.dll but was not handled in user code


Additional information: Connection failed after 4 attempts. Error message:


  The handshake failed due to an unexpected packet format.


I couldn't connect to qliksense with userdirectory and only with userid. what would be the user directory.

I have checked publicexamples but that doesn't helped.


Could you please suggest what way i can connect to qliksense with only userid  and so that i can fetch user specific list of sheet objects . This code we are integrating in application with windows authentication and 'networkservice' as pool identity.



Øystein_Kolsrud
Employee
Employee

I'm somewhat confused. Do you mean you are able to connect with a certain set of credentials, but not with another set? I don't know what type of account your "networkservice" is, but you will have to use an account that is known to Qlik Sense.

But the answer to your last question is that you have to have a user directory. If you have a hard time figuring out which user directory to use, then you could look it up in the QMC of Qlik Sense under "Users".

lavanyaravilla
Contributor
Contributor
Author

Actually..i have taken directory from QMS and trying to connect from .net using below statement

   location.AsDirectConnection("R02", "XXXXX");

where R02-- domain

          XXXXX-- userid

  But for this also i am getting above mentioned error.

Thanks ,

Lavanya

Øystein_Kolsrud
Employee
Employee

If you are doing a direct connection, then you will need to add the engine port to your URL. The port is configurable, but it's usually 4747 for Qlik Sense servers (typically 4848 for desktop). So try to write your URL like this instead:

var location = Location.FromUri("http://localhost:4747");

By the way, I get that "unexpected packet format" message when I try to do a direct connection to "http://localhost" (without the port). Is that what you did?