摘要:
在WEB FORM 里可以写一个通用类继承自Page类,在其Page_Load()事件中对session进行验证。而在MVC中可以使用C#的"特性"(或者叫过滤器)来进行身份验证。自定义一个过滤器,重写其OnActionExecuting(ActionExecutingContext)方法。该方法是在Action执行之前先进行验证。public class LoginFilter : System.Web.Mvc.ActionFilterAttribute{ public override void OnActionExecuting(System.Web.Mvc.Acti 阅读全文
posted @ 2013-06-27 17:22
smallerpig
阅读(893)
评论(0)
推荐(0)
摘要:
前端cshtml里面需要decode时使用@Html.Raw(HttpUtility.HtmlDecode(Model.Contents))对应的action里需要encode的地方使用HttpUtility.HtmlEncode(collection["newsContentData"]); 阅读全文
posted @ 2013-06-27 14:31
smallerpig
阅读(530)
评论(0)
推荐(0)