Running the following ASPX page (IIS 6, Server 2003 R2)
<%@ Page Language="vb" AutoEventWireup="false" %>
<%
Response.Write("Am I running in a terminal server session: " & _
System.Windows.Forms.SystemInformation.TerminalServerSession)
%>
yields the following output:
Am I running in a terminal server session: True
Why? IIS is running as a service, not as a Terminal Services application...
(BTW, according to Reflector, SystemInformation.TerminalServerSession
is just a wrapper for GetSystemMetrics(SM_REMOTESESSION)
.)