public void GetCurrentProcessInfo_PermitOnly_High() { try { ProcessModelInfo.GetCurrentProcessInfo(); } catch (HttpException) { // expected (as we're not running ASP.NET) } }
public void GetCurrentProcessInfo_PermitOnly_High() { try { ProcessModelInfo.GetCurrentProcessInfo(); } catch (HttpException) { // ms 2.x - kind of expected (as we're not running ASP.NET) } catch (TypeInitializationException) { // ms 1.x - fails initializing HttpRuntime } }
public void GetCurrentProcessInfo_Deny_High() { ProcessModelInfo.GetCurrentProcessInfo(); }
public static void Info(ScriptContext /*!*/ scriptContext) { TextWriter output = scriptContext.Output; HttpContext ctx = HttpContext.Current; output.WriteLine("<br><div style='background-color:oldlace'><H3>Phalanger debug info:</H3><PRE>"); output.WriteLine("</PRE><H3>HttpRuntime</H3><PRE>"); output.WriteLine("AppDomainAppId = {0}", HttpRuntime.AppDomainAppId); output.WriteLine("AppDomainAppPath = {0}", HttpRuntime.AppDomainAppPath); output.WriteLine("AppDomainAppVirtualPath = {0}", HttpRuntime.AppDomainAppVirtualPath); output.WriteLine("AppDomainId = {0}", HttpRuntime.AppDomainId); output.WriteLine("AspInstallDirectory = {0}", HttpRuntime.AspInstallDirectory); output.WriteLine("BinDirectory = {0}", HttpRuntime.BinDirectory); output.WriteLine("ClrInstallDirectory = {0}", HttpRuntime.ClrInstallDirectory); try { output.WriteLine("CodegenDir = {0}", HttpRuntime.CodegenDir); } catch (Exception) { output.WriteLine("CodegenDir = N/A"); } output.WriteLine("MachineConfigurationDirectory = {0}", HttpRuntime.MachineConfigurationDirectory); output.WriteLine("</PRE><H3>Worker Process</H3><PRE>"); output.Write("Worker processes: "); if (ctx != null) { foreach (ProcessInfo pi in ProcessModelInfo.GetHistory(20)) { output.Write(pi.ProcessID + ";"); } output.WriteLine(); output.WriteLine("Current Worker Process start time: {0}", ProcessModelInfo.GetCurrentProcessInfo().StartTime); } else { output.WriteLine("N/A"); } Process proc = Process.GetCurrentProcess(); output.WriteLine("Current process: Id = {0}", proc.Id); output.WriteLine("Current PrivateMemorySize: {0} MB", proc.PrivateMemorySize64 / (1024 * 1024)); output.WriteLine("Current WorkingSet: {0} MB", proc.WorkingSet64 / (1024 * 1024)); output.WriteLine("Current VirtualMemorySize: {0} MB", proc.VirtualMemorySize64 / (1024 * 1024)); output.WriteLine("Current thread: HashCode = {0}", Thread.CurrentThread.GetHashCode()); output.WriteLine("Current domain: {0}", Thread.GetDomain().FriendlyName); AppDomainInfo(AppDomain.CurrentDomain, output); if (ctx != null) { AppDomainInfo(AppDomain.CurrentDomain, output); } output.WriteLine("</PRE><H3>Libraries</H3><PRE>"); foreach (PhpLibraryAssembly a in scriptContext.ApplicationContext.GetLoadedLibraries()) { a.Descriptor.Dump(output); } //output.WriteLine("</PRE><H3>Invalidated Precompiled Scripts</H3><PRE>"); //foreach (string item in WebServerManagersDebug.GetInvalidatedScripts()) // output.WriteLine(item); output.WriteLine("</PRE><H3>Cache</H3><PRE>"); foreach (DictionaryEntry item in HttpRuntime.Cache) { if (item.Value is string) { output.WriteLine("{0} => '{1}'", item.Key, item.Value); } else { output.WriteLine("{0} => instance of {1}", item.Key, item.Value.GetType().FullName); } } if (ctx != null) { output.WriteLine("</PRE><H3>Query Variables</H3><PRE>"); String[] keys; keys = ctx.Request.QueryString.AllKeys; for (int i = 0; i < keys.Length; i++) { output.WriteLine("{0} = \"{1}\"", keys[i], ctx.Request.QueryString.GetValues(keys[i])[0]); } if (ctx.Session != null) { output.WriteLine("</PRE><H3>Session Variables</H3><PRE>"); output.WriteLine("IsCookieless = {0}", ctx.Session.IsCookieless); output.WriteLine("IsNewSession = {0}", ctx.Session.IsNewSession); output.WriteLine("SessionID = {0}", ctx.Session.SessionID); foreach (string name in ctx.Session) { output.Write("{0} = ", name); PhpVariable.Dump(ctx.Session[name]); } } output.WriteLine("</PRE><H3>Cookies</H3><PRE>"); foreach (string cookie_name in ctx.Request.Cookies) { HttpCookie cookie = ctx.Request.Cookies[cookie_name]; Console.WriteLine("{0} = {1}", cookie.Name, cookie.Value); } output.WriteLine("</PRE><H3>Server Variables</H3><PRE>"); keys = ctx.Request.ServerVariables.AllKeys; for (int i = 0; i < keys.Length; i++) { output.WriteLine("{0} = \"{1}\"", keys[i], ctx.Request.ServerVariables.GetValues(keys[i])[0]); } } else { output.WriteLine("</PRE><H3>Missing HttpContext</H3><PRE>"); } output.WriteLine("</PRE></DIV>"); }