
Asp.net MVC
try530
这个作者很懒,什么都没留下…
展开
-
MVC缓存的使用
MVC3缓存之一:使用页面缓存在MVC3中要如果要启用页面缓存,在页面对应的Action前面加上一个OutputCache属性即可。我们建一个Demo来测试一下,在此Demo中,在View的Home目录下的Index.cshtml中让页面输入当前的时间。@{ Layout原创 2011-07-12 10:44:50 · 11409 阅读 · 0 评论 -
让MVC支持真实路径的Htm静态页面
在Web.config 中增加红色字部分 这样就可以用真实路径访问htm文件了原创 2011-07-12 10:16:58 · 1448 阅读 · 0 评论 -
MVC3-RAZOR WebGrid 用法详解
WebGrid的方法签名public WebGrid(IEnumerable source, 设置数据源IEnumerable columnNames = null, 要显示的列名string defaultSort = null, 默认排序的字段int rowsPerPage转载 2011-07-12 17:14:07 · 2287 阅读 · 0 评论 -
利用AuthorizeAttribute属性简单避免 MVC 中的跨域攻击
跨域攻击---自然来路页面和目标页面不在同一个域下,所以直接判断来路域和当前自己的域就可以了。 可以广泛应用于表单提交,ajax调用或者某些不想让用户直接输入网址看到的页面 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; n原创 2012-07-24 23:42:33 · 3731 阅读 · 0 评论 -
MVC中使用AuthorizeAttribute做身份验证操作
代码顺序为:OnAuthorization-->AuthorizeCore-->HandleUnauthorizedRequest 如果AuthorizeCore返回false时,才会走HandleUnauthorizedRequest 方法,并且Request.StausCode会返回401,401错误又对应了Web.config中 的 <authentication m原创 2012-07-24 23:34:27 · 31388 阅读 · 4 评论