使用过滤器~
下面这个是定义一个日志过滤器
public class LogFilter : ActionFilterAttribute { private string _operate; public string Operate { get { return _operate; } set { _operate = value; } } public override void OnActionExecuted(ActionExecutedContext filterContext) { HttpSessionStateBase session = filterContext.HttpContext.Session; if (session["Edu_Users"] != null) { Edu_Users CurrentUser = session["Edu_Users"] as Edu_Users; Edu_Log item = new Edu_Log { Id = Guid.NewGuid(), Uid = CurrentUser.Id, Loginname = CurrentUser.Loginname, Realname = CurrentUser.Realname, DepName = CurrentUser.EduDepartment.Name, RoleName = CurrentUser.EduRole.Name, CreateDate = DateTime.Now, Content = Operate, Remarks = "", Status = 0 }; Edu_LogBLL.AddLog(item); } } }
[LogFilter(Operate = "编辑用户")] public ActionResult MemberEdit(Guid id) { }
提交到同一个Action,在Action中检查。
用插件呗Uploadify,可以设定上传文件格式的
这个前端用js验证,服务器端不就是表单提交,验证一下就可以了啊
我记得 mvc中 有 动作过滤器