HttpContent

Controller:HttpContextBase

View:HttpContext.Current

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

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

input,
select,
textarea {
    max-width: 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(","));
}

MVC5 烂笔头的更多相关文章

  1. 【烂笔头】git常用命令篇

    前言 常言道,好记性不如烂笔头,更何况笔者的记性也不是太好,于是就有了这篇“烂笔头”系列之一的git命令记录.本篇主要记录了笔者在工作当中使用过的相关命令,以方便平时查看,同时也供同行们参考.当然,读 ...

  2. Common lang一些边界方法总结(好记性不如烂笔头,需要慢慢积累).一定要利用好现有的轮子,例如Apache common与Google Guava

    好记性真是不如烂笔头啊!!!! 如下代码: List<String> list = new ArrayList<String>(); list.add("1" ...

  3. 好记性不如烂笔头-linux学习笔记1

    好记性不如烂笔头-linux学习笔记1 linux的文件系统有ext2,ext3,ext4,目前主流是ext4 linux主要用于服务器级别的操作系统,安装时需要至少2个分区 一个是交换分区,swap ...

  4. 好记性不如烂笔头-Mysql查找如何判断字段是否包含某个字符串

    好记性不如烂笔头-Mysql查找如何判断字段是否包含某个字符串 利用mysql 字符串函数 find_in_set(); SELECT * FROM users WHERE find_in_set(' ...

  5. [nodejs]修改全局包位置,修复npm安装全局模块命令失效。好记性不如烂笔头

    修复npm -g 全局安装命令失效,好的吧不得不承认,好记性不如烂笔头,我居然会忘记方法哈哈哈 Linux安装nodejs sudo apt install node sudo apt install ...

  6. MVC 好记星不如烂笔头之 ---> 全局异常捕获以及ACTION捕获

    public class BaseController : Controller { /// <summary> /// Called after the action method is ...

  7. MVC 好记星不如烂笔头之 ---> 页面压缩GIP

    public class BaseController : Controller { /// <summary> /// Called before the action method i ...

  8. 好脑袋不如烂笔头-Quartz使用总结

    Quartz是Java平台的一个开源的作业调度框架.Quartz.net是从java版本移植到.net版本的..net项目使用Quartz来执行批处理等定时任务非常方便. (1)从nuget上可以安装 ...

  9. Unity烂笔头1-自定义INSPECTOR属性窗口节点项

    1.添加输入框和标签 LevelScript: using UnityEngine; using System.Collections; public class LevelScript : Mono ...

随机推荐

  1. linux笔记:linux常用命令-压缩解压命令

    压缩解压命令:gzip(压缩文件,不保留原文件.这个命令不能压缩目录) 压缩解压命令:gunzip(解压.gz的压缩文件) 压缩解压命令:tar(打包压缩目录或者解压压缩文件.打包的意思是把目录打包成 ...

  2. 《Java程序设计》实验五 实验报告

    实验五 java网络编程 实验内容 XP基础 XP核心实践 相关工具 实验要求 1.没有Linux基础的同学建议先学习<Linux基础入门(新版)><Vim编辑器> 课程 2. ...

  3. 《Java程序设计》第九周学习总结

    20145224 <Java程序设计>第九周学习总结 第十六章 整合数据库 JDBC入门 ·数据库本身是个独立运行的应用程序 ·撰写应用程序是利用通信协议对数据库进行指令交换,以进行数据的 ...

  4. nodeschool.io 6

    ~~ MAKE IT MODULAR ~~ This problem is the same as the previous but introduces the concept ofmodules. ...

  5. WCF中Service Configuration Editor的使用方法

    1.在App.config文件上右击,选择Edit WCF Configuration.... 或者打开Program Files\Microsoft Visual Studio 8\Common7\ ...

  6. (06)odoo报表

    ----------更新时间:18:06 2016-09-18 星期日18:13 2016-04-05 星期二10:31 2016-03-01 星期二----------* odoo8 采用是Qweb ...

  7. 初学java之事件响应(结合接口来设置在同一个界面上!)

    package wahaha; public class test_1 { public static void main( String args[] ) { WindowActionEvent w ...

  8. Unique Paths [LeetCode]

    A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The ...

  9. 张艾迪(创始人):出现在世界224C之前的这些时间

    出现在世界224C之前的这些时间 坐在大巴车上.用手塞住耳朵.繁杂的大巴车上.总会听见不喜欢听的声音.那时只有22.23岁的我.就像发明一些东西把所有不喜欢的声音都屏蔽掉.就像防火墙一样.那时候拥抱所 ...

  10. placehold.it-在线图片生成器(转载)

    做网站的时候 如果 有的产品等客户没有上传图片,可以用这个网站生成的图片 并配以文字进行图片的占位 以免造成页面的空挡或者页面错位等 原文地址:http://www.cnblogs.com/xumen ...