@using System.Diagnostics;
@using System.Collections;
@using System.Reflection;
@using System.Runtime.Versioning;
@using NewLife.Common;
@{
Layout = NewLife.Cube.Setting.Current.Layout;
ViewBag.Title = "服务器变量列表";
var Act = ViewBag.Act;
var asm = Assembly.GetExecutingAssembly();
var att = asm.GetCustomAttribute<TargetFrameworkAttribute>();
var ver = att.FrameworkDisplayName ?? att.FrameworkName;
var req = HttpContext.Current.Request;
}
<table class="table table-bordered table-hover table-striped table-condensed">
<tr>
<th colspan="6">
服务器变量列表
</th>
</tr>
<tr>
<th>名称</th>
<th>数值</th>
</tr>
@foreach (var key in Request.ServerVariables.AllKeys)
{
var v = Request.ServerVariables[key];
v = v.Replace("\r\n", "</br>");
if (key.EqualIgnoreCase("HTTP_COOKIE")) { v = v.Replace(";", "</br>"); }
<tr>
<td>@key</td>
<td>@Html.Raw(v)</td>
</tr>
}
</table>
<table class="table table-bordered table-hover table-striped table-condensed">
<tr>
<th colspan="6">
Request变量列表 @req.GetType().FullName
</th>
</tr>
<tr>
<th>名称</th>
<th>数值</th>
</tr>
@foreach (var pi in req.GetType().GetProperties())
{
if (pi.GetIndexParameters().Length > 0 || (pi.PropertyType != typeof(String) && pi.PropertyType != typeof(Uri))) { continue; }
var v = req.GetValue(pi) + "";
v = v.Replace("\r\n", "</br>");
<tr>
<td>@pi.Name</td>
<td>@Html.Raw(v)</td>
</tr>
}
</table>
|