static MachineKeyWrapper() { MachineKeySection config = (MachineKeySection)ConfigurationManager.GetSection("system.web/machineKey"); Type machineKeyType = config.GetType().Assembly.GetType("System.Web.Configuration.MachineKeySection"); BindingFlags bf = BindingFlags.NonPublic | BindingFlags.Static; _encrypt = typeof(System.Web.UI.Page).GetMethod("EncryptString", bf, null, new[] { typeof(string) }, null); _decrypt = typeof(System.Web.UI.Page).GetMethod("DecryptString", bf, null, new[] { typeof(string) }, null); }