Process.SessionId Property

Note: This property is new in the .NET Framework version 2.0.

Gets the Terminal Services session identifier for the associated process.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

public int SessionId { get; }
/** @property */
public int get_SessionId ()

public function get SessionId () : int

Property Value

The Terminal Services session identifier for the associated process.

Exception typeCondition


There is no process associated with this session identifier.


The associated process is not on this machine.


The SessionId property is not supported on Windows 98.

The SessionId property identifies the session in which the application is currently running.

Windows 98, Windows 2000 SP4, Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions