javascriptwindowssessioncitrixxenapp

Citrix XenApp - Logoff via CMD/DLL/Something


I need your support.

Following case: I created a script for performance measure (AutoIT) which opens the Internet Explorer, loads a Citrix XenApp Page, logs in and starts an application from there.

My Problem is the Logout/Disconnect/Closing of the Session.

Using the URL behind the Logoff Button

In the upper right corner is a Logoff and a disconnect Button. These both calls a Javascript function which rewrites the URL

Logoff (Logoff in the Web GUI and logoff in the Citrix Session. Closes all open Windows from Citrix) javascript:location.replace('../site/logout.aspx?CTX_Token=F692CFB5C3282DDEFE1084DAB381EAF4')

disconnect (Logoff in the GUI, closes the session. In the next login it reopens all citrix windows) javascript:location.replace('../site/disconnect.aspx?CTX_Token=F692CFB5C3282DDEFE1084DAB381EAF4')

The CTX_Token is not static. After every logon I have a new token.

My goal is: To close, if there is one, the open session, before I open a new session.

Call the URL without token, with token set to 0 and to complete F/0,

Every time I get only a State Error

State Error

There is a problem with your session. For security reasons, you must close your browser window and log on again to continue accessing your resources.

To log on again, you must restart your browser.

No success on this way :/

A Parameter in the Citrix Connection Center

My next hope was a Parameter in the Receiver.exe to disconnect the session.

In the GUI of the concentr.exe is a disconnect and logoff button. But the exe has no help in the cmd. It seems, that this exe has parameters (Task Manager concentr.exe /startup I tried it with following parameters. Every time only the GUI starts...

Maybe one of you have an idea...

Quit the Citrix Connection Center and the Citrix Receiver

These both ways are like disconnect in the Webgui.

Not that what I wanted..

Close the IE (logoff in the Browser) and kill the open Citrix Windows

Not really the correct way. It is possible, that there is process which survives everything

Other ways?

I searched for DLL Calls, for APIs, CMD and other stuff. I found nothing.

Maybe here is a Citrix Pro which is reading this and can deliver me an answer.

Have a nice day

Nice regards

Hagen


Solution

  • You are automating/webscraping StoreFront but it's better to use the StoreFront SDK. Here is an example for Logoff taken from the documentation:

    Example: LogOff Request

    POST http://www.example.com/Store/sessions/v1/logoff HTTP/1.1
    Host: www.example.com
    Accept: application/vnd.citrix.sessionresults+xml
    Content-Type: application/vnd.citrix.sessionparams+xml
    Content-Length: xxx
    Authorization: CitrixAuth ...
    
    <?xml version="1.0"?>
    <sessionparams xmlns="http://citrix.com/delivery-services/1-0/sessionparams">
    <clientName>xxxxxxxxx</clientName>
    <deviceId>xxxxxxxxx</deviceId>
    <tickets>
    <ticket>85EB92973D2C3804F93A99AAEC232D</ticket>
    <ticket>85EB92973D2C3804F93A99AAEC232A</ticket>
    </tickets>
    </sessionparams>
    

    Response

    HTTP/1.1 200 OK
    Content-Type: application/vnd.citrix.sessionresults+xml
    Content-Length: xxx
    Cache-Control: no-cache
    
    <?xml version="1.0"?>
    <sessionResults xmlns="http://citrix.com/delivery-services/1-0/sessionresult" status="success" />