paul_cheung

导航

随笔分类 -  asp.net MVC

asp.net mvc return file result
摘要:asp.net mvc返回文件:public ActionResult ExportReflection(string accessToken) { var reflections = GetCmsReflectionList(accessToken); ... 阅读全文

posted @ 2014-04-14 15:17 paul_cheung 阅读(630) 评论(0) 推荐(0)

ajax请求后根据条件进行页面跳转
摘要:$.ajx({ url: "@Url.Action("DetectCorporationCompetencyCreated", "DataBase")", data: { corporationId: rowId }, async:false, success: function (data) { ... 阅读全文

posted @ 2014-04-08 17:58 paul_cheung 阅读(714) 评论(0) 推荐(0)

A potentially dangerous Request.Form value was detected from the client
摘要:提交表单中包含特殊字符如可能被认为是跨站攻击代码;解决方法很多,如stackoverflow上的web.config中加设置的方法不中肯[如原贴中Jamie M所说],主要是在.net4.5 asp.net mvc5下用(和)会报错[至少在我本机上有这个问题],于是就如Jamie M建议的做法:在C... 阅读全文

posted @ 2014-03-28 21:26 paul_cheung 阅读(202) 评论(0) 推荐(0)

Dependency Injection in ASP.NET MVC
摘要:原文引自http://www.dotnetcurry.com/ShowArticle.aspx?ID=7861.传统三层结构,相邻两层之间交互; 2.如果使用EntityFramework则View层直接与Db层交互,如在Controller中定义DbContext操作数据库,属于紧耦合; 3.解决2中紧耦合的方法:1)定义IRepository(CRUD),此接口在对应数据层实现(DbContext);2)Controller中只使用IRepository实例出的相应Repository,进而达到松耦合的目的; 4.Controller默认使用无参构造函数,不能以传递参数的方式实例化Cont 阅读全文

posted @ 2013-07-15 19:17 paul_cheung 阅读(435) 评论(0) 推荐(0)