The getSession method of the AspContext class creates an instance of the Session object.
public static Session getSession();
The following example shows how to use the Session object to determine the current SessionID.
import com.ms.iis.asp.*; public class getsesstest { public String getSessId() { Session sessMySess = AspContext.getSession(); //Returns the number of items on the form String strSessId = sessMySess.getSessionID(); return strSessId; } }