文章分类 -  asp.net MVC

摘要:Application_BeginRequest:每次请求都会触发,此时还没有Session Application_AcquireRequestState:每次请求都会触发,此时有Session,处理一些请求状态 Init:初始化,启动网站时触发,以后每次请求不会触发 先后顺序:Init->App 阅读全文
posted @ 2018-09-30 17:07 花生打代码会头痛 阅读(154) 评论(0) 推荐(0)
摘要:Web Api默认是关闭Session 启用要在全局文件写入下面代码 阅读全文
posted @ 2018-09-30 17:03 花生打代码会头痛 阅读(137) 评论(0) 推荐(0)
摘要:[HttpGet] public void DownUpdateOrderStateTmp() { string filePath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "/Data/UpdateOrderStateTmp.xlsx"; ... 阅读全文
posted @ 2017-08-10 10:13 花生打代码会头痛 阅读(69) 评论(0) 推荐(0)
摘要:LINQ to Entities 不识别方法“XX”,因此该方法无法转换为存储表达式 使用LINQ to Entities一不小心就会碰上类似的错误: 引用内容 。LINQ to Entities 不识别方法“XX”,因此该方法无法转换为存储表达式 引用内容 。LINQ to Entities 不识 阅读全文
posted @ 2017-06-30 14:53 花生打代码会头痛 阅读(320) 评论(0) 推荐(0)
摘要:public class UserAuthorizeAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext.Http... 阅读全文
posted @ 2017-06-08 14:35 花生打代码会头痛 阅读(107) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2017-05-17 16:00 花生打代码会头痛 阅读(71) 评论(0) 推荐(0)
摘要:注意点: 这个拓展方法的lamdba表达式并不支持类型转换,否则会报错。 解决方案: 先类型转换,再用lamdba。 阅读全文
posted @ 2017-05-05 16:06 花生打代码会头痛 阅读(765) 评论(0) 推荐(0)
摘要:ORM:EF,linq to EF,SQL Server Profiler监控SQL IQueryable: 结果:执行了3次SQL, 第一次是查 int count = act.Count(); 第二次是查 List<ActGift_J> data1 = act.OrderBy(m=>m.Gift 阅读全文
posted @ 2017-04-23 01:44 花生打代码会头痛 阅读(168) 评论(0) 推荐(1)
摘要:string path = AppDomain.CurrentDomain.BaseDirectory + "/Resource/XML/CityAddressInfo.xml"; 阅读全文
posted @ 2017-04-20 16:52 花生打代码会头痛 阅读(69) 评论(0) 推荐(0)
摘要:查: 改: 增: 删: 阅读全文
posted @ 2017-04-13 21:06 花生打代码会头痛 阅读(77) 评论(0) 推荐(0)
摘要:属性特性主要应用于类的字段或者属性,以验证是否符合特性。 asp.net MVC里就自带了许多这样的属性特性,例如[Required]、[Display(Name = "用户名")]、[DataType(DataType.Password)]、 [StringLength(100, ErrorMes 阅读全文
posted @ 2017-01-26 02:02 花生打代码会头痛 阅读(686) 评论(0) 推荐(0)
摘要:1.[ASP.NET MVC 小牛之路]02 - C#知识点提要 里面有简单说明 2.声明一个类是一个特性(Attributes),必须在类前面加上[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method,AllowMultiple 阅读全文
posted @ 2017-01-25 21:20 花生打代码会头痛 阅读(191) 评论(0) 推荐(0)
摘要:1.一定要引用js 2.用@using (Html.BeginForm()){}来提交表单的时候,如果有方式CSRF攻击的代码@Html.AntiForgeryToken()时要这样处理, a.在form中new一个id, new { @class = "form-horizontal", role 阅读全文
posted @ 2017-01-22 21:45 花生打代码会头痛 阅读(123) 评论(0) 推荐(0)
摘要:http://www.cnblogs.com/xielong/p/5940535.html 阅读全文
posted @ 2016-12-28 14:56 花生打代码会头痛 阅读(54) 评论(0) 推荐(0)
摘要:1.自定义登录验证的过滤器(用seesion保存用户名,不用数据库) 1 /// <summary> 2 /// 登录验证 3 /// </summary> 4 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inh 阅读全文
posted @ 2016-11-21 15:36 花生打代码会头痛 阅读(108) 评论(0) 推荐(0)