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(","));
}