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(","));
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 写一个简单的SQL生成工具
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)