protected void ShowRequests(IList data) { // add the title, application name, physical path, etc. Table table = new Table(); table.CellPadding = 0; table.CellSpacing = 0; table.Width = Unit.Percentage(100); TableRow trow = AddRow(table); TableCell tcell; AddCell(trow, SR.GetString(SR.Trace_Application_Trace)); string vroot = _request.ApplicationPath; int vrootLen = vroot.Length; trow = AddRow(table); AddCell(trow, "<h2>" + HttpUtility.HtmlEncode(vroot.Substring(1)) + "<h2><p>"); trow = AddRow(table); AddCell(trow, "[ <a href=\"Trace.axd?clear=1\" class=\"link\">" + SR.GetString(SR.Trace_Clear_Current) + "</a> ]"); // check if we have permission to show the physical path. If not, don't show anything. string physicalPath = " "; if (HttpRuntime.HasAppPathDiscoveryPermission()) { physicalPath = SR.GetString(SR.Trace_Physical_Directory) + _request.PhysicalApplicationPath; } trow = AddRow(table); tcell = AddCell(trow, physicalPath); table.RenderControl(_writer); //////// add the table of requests /////// table = new Table(); table.CellPadding = 0; table.CellSpacing = 0; table.Width = Unit.Percentage(100); trow = AddRow(table); // title for the table tcell = AddHeaderCell(trow, "<h3><b>" + SR.GetString(SR.Trace_Requests_This) + "</b></h3>"); tcell.ColumnSpan = 5; tcell.CssClass = "alt"; tcell.HorizontalAlign = HorizontalAlign.Left; tcell = AddHeaderCell(trow, SR.GetString(SR.Trace_Remaining) + " " + HttpRuntime.Profile.RequestsRemaining.ToString(NumberFormatInfo.InvariantInfo)); tcell.CssClass = "alt"; tcell.HorizontalAlign = HorizontalAlign.Right; // add headers for the columns trow = AddRow(table); trow.HorizontalAlign = HorizontalAlign.Left; trow.CssClass = "subhead"; AddHeaderCell(trow, SR.GetString(SR.Trace_No)); AddHeaderCell(trow, SR.GetString(SR.Trace_Time_of_Request)); AddHeaderCell(trow, SR.GetString(SR.Trace_File)); AddHeaderCell(trow, SR.GetString(SR.Trace_Status_Code)); AddHeaderCell(trow, SR.GetString(SR.Trace_Verb)); AddHeaderCell(trow, " "); // now fill the table with requests bool isAlt = true; for (int i = 0; i < data.Count; i++) { // for each request DataSet current = (DataSet)data[i]; trow = AddRow(table); if (isAlt) { trow.CssClass = "alt"; } AddCell(trow, (i + 1).ToString(NumberFormatInfo.InvariantInfo)); AddCell(trow, (string)current.Tables[SR.Trace_Request].Rows[0][SR.Trace_Time_of_Request]); AddCell(trow, HttpUtility.HtmlEncode((string)current.Tables[SR.Trace_Request].Rows[0][SR.Trace_Url]).Substring(vrootLen)); AddCell(trow, current.Tables[SR.Trace_Request].Rows[0][SR.Trace_Status_Code].ToString()); AddCell(trow, (string)current.Tables[SR.Trace_Request].Rows[0][SR.Trace_Request_Type]); TableCell linkcell = AddCell(trow, String.Empty); HtmlAnchor a = new HtmlAnchor(); a.HRef = "Trace.axd?id=" + i; a.InnerHtml = "<nobr>" + SR.GetString(SR.Trace_View_Details); a.Attributes["class"] = "link"; linkcell.Controls.Add(a); isAlt = !isAlt; } table.RenderControl(_writer); }
protected void ShowRequests(IList data) { Table t = new Table { CellPadding = 0, CellSpacing = 0, Width = Unit.Percentage(100.0) }; AddCell(AddRow(t), System.Web.SR.GetString("Trace_Application_Trace")); string applicationPath = this._request.ApplicationPath; int length = applicationPath.Length; AddCell(AddRow(t), "<h2>" + HttpUtility.HtmlEncode(applicationPath.Substring(1)) + "<h2><p>"); AddCell(AddRow(t), "[ <a href=\"Trace.axd?clear=1\" class=\"link\">" + System.Web.SR.GetString("Trace_Clear_Current") + "</a> ]"); string text = " "; if (HttpRuntime.HasAppPathDiscoveryPermission()) { text = System.Web.SR.GetString("Trace_Physical_Directory") + this._request.PhysicalApplicationPath; } TableCell cell = AddCell(AddRow(t), text); t.RenderControl(this._writer); t = new Table { CellPadding = 0, CellSpacing = 0, Width = Unit.Percentage(100.0) }; TableRow trow = AddRow(t); cell = AddHeaderCell(trow, "<h3><b>" + System.Web.SR.GetString("Trace_Requests_This") + "</b></h3>"); cell.ColumnSpan = 5; cell.CssClass = "alt"; cell.HorizontalAlign = HorizontalAlign.Left; cell = AddHeaderCell(trow, System.Web.SR.GetString("Trace_Remaining") + " " + HttpRuntime.Profile.RequestsRemaining.ToString(NumberFormatInfo.InvariantInfo)); cell.CssClass = "alt"; cell.HorizontalAlign = HorizontalAlign.Right; trow = AddRow(t); trow.HorizontalAlign = HorizontalAlign.Left; trow.CssClass = "subhead"; AddHeaderCell(trow, System.Web.SR.GetString("Trace_No")); AddHeaderCell(trow, System.Web.SR.GetString("Trace_Time_of_Request")); AddHeaderCell(trow, System.Web.SR.GetString("Trace_File")); AddHeaderCell(trow, System.Web.SR.GetString("Trace_Status_Code")); AddHeaderCell(trow, System.Web.SR.GetString("Trace_Verb")); AddHeaderCell(trow, " "); bool flag = true; for (int i = 0; i < data.Count; i++) { DataSet set = (DataSet)data[i]; trow = AddRow(t); if (flag) { trow.CssClass = "alt"; } AddCell(trow, (i + 1).ToString(NumberFormatInfo.InvariantInfo)); AddCell(trow, (string)set.Tables["Trace_Request"].Rows[0]["Trace_Time_of_Request"]); AddCell(trow, ((string)set.Tables["Trace_Request"].Rows[0]["Trace_Url"]).Substring(length)); AddCell(trow, set.Tables["Trace_Request"].Rows[0]["Trace_Status_Code"].ToString()); AddCell(trow, (string)set.Tables["Trace_Request"].Rows[0]["Trace_Request_Type"]); TableCell cell2 = AddCell(trow, string.Empty); HtmlAnchor child = new HtmlAnchor { HRef = "Trace.axd?id=" + i, InnerHtml = "<nobr>" + System.Web.SR.GetString("Trace_View_Details") }; child.Attributes["class"] = "link"; cell2.Controls.Add(child); flag = !flag; } t.RenderControl(this._writer); }