• MVC5 烂笔头


    HttpContent

    Controller:HttpContextBase

    View:HttpContext.Current

    View的搜寻顺序:本文件夹、本共享、根共享等

    class="form-control"宽度不适100%的问题:修改Site.css

    input,
    select,
    textarea {
        max- 280px;
    }

    没有菜单时,顶部空的太多的问题:修改Site.css

    body {
        padding-top: 20px;
        padding-bottom: 20px;
    }

    Claim 验证的东东

    Login:

    ClaimsIdentity _identity = new ClaimsIdentity(DefaultAuthenticationTypes.ApplicationCookie);
    _identity.AddClaim(new Claim(ClaimTypes.Name, displayName));
    _identity.AddClaim(new Claim(ClaimTypes.UserData, "aaaaaa"));

    _identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, userId));
    _identity.AddClaim(new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", "ASP.NET Identity"));

    _identity.AddClaim(new Claim(ClaimTypes.Role, role1));
    _identity.AddClaim(new Claim(ClaimTypes.Role, role2));


    httpContext.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
    httpContext.GetOwinContext().Authentication.SignIn(new AuthenticationProperties() { IsPersistent = true }, _identity);

    ClaimTypes里面有好多,还可以自定义,在程序中获取登陆时设置的值:

    httpContext.GetOwinContext().Authentication.User.Claims

    用linq可以获取,比较麻烦也不知道对不对

    View里面获取Area、Controller、Action

    ViewContext.RouteData.DataTokens["area"]

    ViewContext.RouteData.Values["controller"]

    ViewContext.RouteData.Values["action"]

    select操作

    <script type="text/javascript">
    $(document).ready(function () {
    $("#DepartList").change(function () {

    $.post("/Suite1/App5/GetDepartUser",
    {
    id: $("#DepartList").val()
    },
    function (response) {
    $("#UserList").empty();
    for (var i = 0; i < response.length; i++) {
    $("#UserList").append("<option value='" + response[i].Key + "'>" + response[i].Value + "</option>");
    }
    });
    });
    });

    </script>

    <div class="input-group">
    <input id="SearchKey" name="Search" type="text" class="form-control" placeholder="输入关键字">
    <span class="input-group-btn">
    <button id="BSearch" name="BSearch" class="btn btn-default" type="button">搜</button>
    </span>
    </div>

    JQuery数组和字符串替换相关

    function EditTag(tag) {
    var str = $("#Tag").val();
    if (str == "") {
    $("#Tag").val(tag);
    return;
    }
    var reg1 = /s/g;
    str = str.replace(reg1, "");
    var reg = /\,/g;
    str = str.replace(reg, ",");
    var tags = str.split(',');
    var index = $.inArray(tag, tags);
    if (index == -1) {
    tags.push(tag);
    }
    else {
    tags.splice(index, 1);
    }
    $("#Tag").val(tags.join(","));
    }

  • 相关阅读:
    【hdu6035】 Colorful Tree dfs序
    【GDOI2018模拟8】 数学竞赛 三角函数性质+记忆化搜索
    【BZOJ4184】shallot 线性基
    失分统计#1
    【learning】微信跳一跳辅助c++详解 轻松上万 【下】
    【2018北京集训十二】 coin 矩阵快速幂
    【learning】微信跳一跳辅助c++详解 轻松上万 【上】
    【2018北京集训6】Lcm DFT&FWT
    【BZOJ3143】【HNOI2013】游走 高斯消元
    【bzoj1855】 [Scoi2010]股票交易 单调队列优化DP
  • 原文地址:https://www.cnblogs.com/catzhou/p/4343607.html
Copyright © 2020-2023  润新知