Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Not applicable

.NET workbench page and passing a user token

Hi,

I'm new here and have done a search, and Googled, but no joy. So apologies if the answer to this is already out there.

I have a qvw file which is secured via DMS and section access, and set to perform data reduction based on the user. I have a forms authentication page for our web app, and code that will retrieve a user token for the logged in user from QVS. The user is also configured under section access. This all works nicely when I have the qvw file opened up via QVS in an iFrame.

What I now want to do is connect to the same qvw file as a datasource for a .NET workbench page. Is it possible to pass the user id or token from the workbench, and have the same data reduction being performed on the underlying qvw?

Hope someone can help! Cheers,

Iain

4 Replies
terrorthijs
New Contributor II

.NET workbench page and passing a user token

I'm having the exact same questions here...

Not applicable

.NET workbench page and passing a user token

In our solution we achieve this by first generating a ticket for the user. The ticket is created using a simple asp-page that looks like this:

<%@ language="JScript" %>
<--
Tickethantering för Coins Analys, Qlikview version 9
2009-11-19 Ändrad av Rebecca Isaksson

Parametrar: user
Användarnamn
Returnerar: ticket
Ticket för tillgång till Coins Analys
-->

<%
// Build $BuildVersion$

Response.Clear();
var host = 'localhost';

if (typeof QvsHost == 'string') host = QvsHost;
if (typeof QvsPort == 'number') host += ":" + QvsPort;

function MakeXmlSafe (value)
{
var val = '' + value;
val = val.replace (/&/g, '&amp;');
val = val.replace (/</g, '&lt;');
val = val.replace (/>/g, '&gt;');
val = val.replace (/"/g, '&quot;');
return val;
}

var user = "" + Request("user");
Response.Expires = -1;
Response.ContentType = "text/xml; charset=utf-8";
var client = Server.CreateObject("QvsRemote.Client");
client.AdminConnect(host);
var request = "<Global method='GetTicket'><UserId>" + MakeXmlSafe(user) + "</UserId></Global>";
var response = client.Execute(request);

//var ticket = Left(response, 58);
//var ticket = Right(ticket, 40);


Response.Write (response);

function Left(str, n){
if (n <= 0)
return "";
else if (n > String(str).length)
return str;
else
return String(str).substring(0,n);
}
function Right(str, n){
if (n <= 0)
return "";
else if (n > String(str).length)
return str;
else {
var iLen = String(str).length;
return String(str).substring(iLen, iLen - n);
}
}

%>

To generate a ticket we simply call this page using a http GET request in code behind with the user as parameter. We then pull the ticket from the response and add it to the querystring on each page (using masterpages). Data reduction based on section access is then handled automatically.

Eg)

http://myurl/mypage.aspx?ticket=252SGSGSSDE356666

(We actually use the parameter "userid" instead of "ticket", but from what I understand it is better to use "ticket". We use the "ticket"-parameter in our authentication process which complicates things a bit in our project.)

Let me know if you need any further information or code examples.

Not applicable

.NET workbench page and passing a user token

Hi Rebecca,

Was your solution working with QlikView Workbench and Forms Authentication?

Thanks,
Matt

Not applicable

.NET workbench page and passing a user token

Yes. We have our own implementation of the actual authentication process, but we do use the built in forms authentication classes and cookie.

Unfortunately I'm on maternity leave at the moment so I don't have access to the code if you have any further questions.

Community Browser