v9.7.2018.0421   支持运行时修改DAL连接字符串
大石头 authored at 2018-04-21 14:00:47
1.68 KiB
X
@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变量列表&nbsp;&nbsp;&nbsp;&nbsp;@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>