Any way to determine if a session was spawned from the client or the browser?

Does anyone know of a way to see if an Epicor session was spawned from the client or the browser? I was hoping that the ‘GetUserSessionAndVersion’ method call that is called during login would contain this information but I have been unable to find it.

My goal is to trigger a BPM on user login that behaves differently depending on if the user used the client or the web browser. I know the kinetic client at this points is basically a web browser in its own right but I was hoping there was some flag somewhere with the distinction. Thanks, any insight is appreciated.

Curious if you could use Ice.BO.AdminSessionSvc > GetCurrentSession.

If the returned dataset column “ClientComputerName” holds a value, then they’re coming from the Client. If it is empty, then they are in the browser?

Never done it, so, can’t attest for whether that would work or not.

4 Likes

I’ll see if this works. Thanks!

1 Like

CallContextClientData.ClientType will give you this:

8 Likes

mr bean is eating chicken wings and saying `` winner , winner , chicken dinner ''

1 Like

Thanks for this. This seems to be the closest. I was hoping to check during the SessonMod.Login call but it seems that CallContextClientData.ClientType is blank during this as the session hasn’t been spawned yet. I’ll have to think of a future downstream trigger I think.

If you are interested if the user is running in the Kinetic browser in the Smart Client vs Kinetic in your default browser, you can also look at the user agent.
Most of the time, the version of the Smart Client browser will be far behind the latest version of Chrome or Edge.
May not be 100% reliable between upgrades as you will have to update the version number if Epicor decides to update the Smart Client Browser version.

if (callContextClient.ClientType == "WinClient")
{
    // Classic running in Smart Client
    return;
}

// Get user agent
string userAgent;
if (Operation.Current.HttpHeaders.TryGetValue("User-Agent", out userAgent) == false)
{
    // No User agent
    return;
}

var match = Regex.Match(userAgent, @"Chrome\/(?<version>\d+)");
if (match.Success == false)
{
     // No match
     return;
}
var chromeVersion = Convert.ToInt32(match.Groups["version"].Value);

// If greater than this version (120 as of 2024.2), the default browser is being used
if (chromeVersion > 120)
{
    // Kinetic in Default browser
}
else
{
    // Kinetic in Smart Client
}

Classic
image

Kinetic in Smart Client

Kinetic In Browser
image

2 Likes

Interesting approach. Thanks for the tip.