torgil

net.aspx

Jun 19th, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.19 KB | None | 0 0
  1. <%@ Page Title="Debug" Language="C#" %>
  2. <%@ Import Namespace="System.Web.Hosting" %>
  3. <html>
  4. <head>
  5. <script language="c#" runat="server">
  6.     StringBuilder sb = new StringBuilder();
  7.    
  8.     public void Page_Load(object sender, EventArgs e)
  9. {
  10.     ApplicationManager appManager = ApplicationManager.GetApplicationManager();
  11.     ApplicationInfo[] appInfo = appManager.GetRunningApplications();
  12.     GridView1.DataSource = appInfo;
  13.  
  14.     String nl = "<br />";
  15.  
  16.     sb.Append("AppDomainAppId = " +
  17.       HttpRuntime.AppDomainAppId + nl);
  18.     sb.Append("AppDomainAppPath = " +
  19.       HttpRuntime.AppDomainAppPath + nl);
  20.     sb.Append("AppDomainAppVirtualPath = " +
  21.       HttpRuntime.AppDomainAppVirtualPath + nl);
  22.     sb.Append("AppDomainId = " +
  23.       HttpRuntime.AppDomainId + nl);
  24.     sb.Append("AspInstallDirectory = " +
  25.       HttpRuntime.AspInstallDirectory + nl);
  26.     sb.Append("BinDirectory = " +
  27.       HttpRuntime.BinDirectory + nl);
  28.     sb.Append("ClrInstallDirectory = " +
  29.       HttpRuntime.ClrInstallDirectory + nl);
  30.     sb.Append("CodegenDir = " +
  31.       HttpRuntime.CodegenDir + nl);
  32.     sb.Append("IsOnUNCShare = " +
  33.       HttpRuntime.IsOnUNCShare.ToString() + nl);
  34.     sb.Append("MachineConfigurationDirectory = " +
  35.       HttpRuntime.MachineConfigurationDirectory + nl);
  36.    
  37.     Page.DataBind();
  38.     Session["now"] = DateTime.Now.ToString();
  39. }
  40.  
  41.  
  42.     public string appdomainid()
  43.     {
  44.         string s = HttpRuntime.AppDomainId;
  45.         if (Session["appdomainid"] != null && Session["appdomainid"] != HttpRuntime.AppDomainId)
  46.         {
  47.             s = Session["appdomainid"] + "->" + s;
  48.         }
  49.        
  50.         Session["appdomainid"] = HttpRuntime.AppDomainId;
  51.         return s;
  52.     }
  53.  
  54. </script>
  55. <title>ASP.NET debug info</title>
  56. </head>
  57. <body>
  58. <form id="form1" runat="server">
  59. <table>
  60.         <tr>
  61.         <th>DateTime.Now</th>
  62.         <td><%# DateTime.Now.ToString() %></td>
  63.         </tr>
  64.         <tr>
  65.         <th>HostingEnvironment.ApplicationID</th>
  66.         <td><%# HostingEnvironment.ApplicationID %></td>
  67.         </tr>
  68.         <tr>
  69.         <th>HostingEnvironment.ApplicationPhysicalPath</th>
  70.         <td><%# HostingEnvironment.ApplicationPhysicalPath %></td>
  71.         </tr>
  72.         <tr>
  73.         <th>HostingEnvironment.ApplicationVirtualPath</th>
  74.         <td><%# HostingEnvironment.ApplicationVirtualPath %></td>
  75.         </tr>
  76.         <tr>
  77.         <th>HostingEnvironment.SiteName</th>
  78.         <td><%# HostingEnvironment.SiteName %></td>
  79.         </tr>
  80.         <tr>
  81.         <th>HostingEnvironment.ShutdownReason</th>
  82.         <td><%# HostingEnvironment.ShutdownReason.ToString() %></td>
  83.         </tr>
  84.         <tr>
  85.         <th>Environment.Version</th>
  86.         <td><%# Environment.Version.ToString() %></td>
  87.         </tr>
  88.         <tr>
  89.         <th>Environment.WorkingSet</th>
  90.         <td><%# Environment.WorkingSet.ToString() %> bytes (<%# (Environment.WorkingSet / 1024 / 1024).ToString()%> MB)</td>
  91.         </tr>
  92.         <tr>
  93.         <th>HttpRuntime.AppDomainId</th>
  94.         <td><%# appdomainid() %></td>
  95.         </tr>
  96.         <tr>
  97.         <th>GC.GetTotalMemory</th>
  98.         <td><%# GC.GetTotalMemory(false).ToString() %> bytes (<%# (GC.GetTotalMemory(false) / 1024 / 1024).ToString() %> MB)</td>
  99.         </tr>
  100.         <tr>
  101.         <th>Environment.MachineName</th>
  102.         <td><%# Environment.MachineName %></td>
  103.         </tr>
  104.         <tr>
  105.         <th>Environment.OSVersion</th>
  106.         <td><%# Environment.OSVersion %></td>
  107.         </tr>
  108.         <tr>
  109.         <th>Environment.UserName</th>
  110.         <td><%# Environment.UserName %></td>
  111.         </tr>
  112.         <tr>
  113.         <th>Environment.TickCount</th>
  114.         <td><%# Environment.TickCount.ToString() %></td>
  115.         </tr>
  116.         <tr>
  117.         <th>Session.SessionID</th>
  118.         <td><%# Session.SessionID.ToString() %></td>
  119.         </tr>
  120.         <tr>
  121.         <th>Request.ServerVariables["SERVER_SOFTWARE"]</th>
  122.         <td><%# Request.ServerVariables["SERVER_SOFTWARE"] %></td>
  123.         </tr>
  124.         <tr>
  125.         <th>AppPoolId</th>
  126.         <td><%# Environment.GetEnvironmentVariable("APP_POOL_ID", EnvironmentVariableTarget.Process)%></td>
  127.         </tr>
  128.         <tr>
  129.         <th>AppPoolId</th>
  130.         <td><%# HttpContext.Current.Request.ServerVariables["APP_POOL_ID"] %></td>
  131.         </tr>
  132. </table>
  133.     <asp:GridView ID="GridView1" runat="server">
  134.     </asp:GridView>
  135.  
  136.     <p><%# sb.ToString() %></p>
  137.     <asp:Button ID="btnPostBack" runat="server" Text="ok" />
  138.   </form>
  139. </body>
  140. </html>
Advertisement
Add Comment
Please, Sign In to add comment