SessionId Property

Process.SessionId Property

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

Not applicable.

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.

  • LinkDemand  for full trust for the immediate caller. This member cannot be used by partially trusted code.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

© 2015 Microsoft