mvc 小计
来源:互联网 发布:武汉软件培训 编辑:程序博客网 时间:2024/05/29 16:17
使用mvc 小计
1.关于页面{
[mvcapplication模式]
csthml=”需要一个新的control类对应否则访问会找不到(为什么会这样呢 因为每个页面的呈现都需要经过control类的逻辑处理)”,
“RenderPatial RenderAction 区别 “=”RenderPatial的数据来自于调用的View,而RenderAction来自自己。[取于其他人总结]”,
“RenderPatial RenderAction 区别 “=”RenderAction会发起一个新的Request,而RenderPatial不会。[取于其他人总结
详情参考 csdn死对头
http://www.cnblogs.com/gesenkof99/archive/2013/06/03/3115052.html
]”,
}
2.关于页面控件{
[呈现html控件]
@Html.LabelFor(m => m.name) = “显示[Display] 的内容”,
@Html.Label(m => m.mypwd)=“显示model属性的值”,
@Html.ValidationMessageFor(m=>m.name) =”如果要显示验证信息需要加上这个”,
}
3.关于控制{
身份
[AllowAnonymous] =”身份验证需要配置web.config[
]”,
自定义验证=”重写ActionFilterAttribute[
public class IsLogin : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
bool isLogin = false;
//用MVC系统自带的功能 获取当前方法上的特性名称 bool skipAuthorization = filterContext.ActionDescriptor.IsDefined(typeof(NoNeedLogin), inherit: true) || filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(NoNeedLogin), inherit: true); if (skipAuthorization) { return; } //检查是否登录 AdminBll adminBll = new AdminBll(); if (!adminBll.IsLogin()) { //强制调转实现身份验证 filterContext.HttpContext.Response.Redirect("http://" + filterContext.HttpContext.Request.Url.Authority + "/Admin/Login"); } }} //忽略身份验证 public class NoNeedLogin : Attribute{ } //验证 [IsLogin]public class AdminController : BaseController{ //登录 表单(忽略验证) [NoNeedLogin] public ActionResult Login() { return View(); }
]”
}
- MVC小计
- MVC小计
- mvc 小计
- 小计
- 小计
- oracle小计
- 学习小计
- ISPCP 小计
- SMARTFORMS 小计
- MM小计
- html小计
- ABAP小计
- 树小计
- 随笔小计
- typedef小计
- 小计 合计
- 接口小计~~~~
- EditText小计
- 实数是如何存储在计算机内部的
- 聊天室
- s232、rs422和rs485通讯接口的区别
- IIS7.5安装后ASP+access数据库连接错误的问题解决办法
- GCD 编程
- mvc 小计
- linux下C编程(一)之 hello world
- [BZOJ1106] [POI2007]立方体大作战tet
- Codeforces 585D Lizard Era: Beginning
- Leetcode Recover Binary Tree
- MyEclipse设置JAVA选中高亮显示
- pcduino里,Qt无法打开摄像头(调用了opencv)
- LeetCode40——Combination Sum II
- Java 正则表达式