标签:asp.net mvc4
最近一个月都在专心做unity3d的斗地主游戏,从早到晚,最后总算是搞出来了,其中的心酸只有自己知道。最近才有功夫闲下来,还是学习学习之前的老本行——asp.net,现在用.net做项目流行MVC,而不是之前的三层,既然技术在更新,只能不断学习,以适应新的技术潮流!
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}", //controller目录下的,action匹配Controllers目录下actionresult,id是一个可写参数
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } //默认启动项HomeController下的Index
);这个文件是路由注册文件,配置默认启动项,这里指定的controller是HomeController,actionResult是Index,id可写可不写。public ActionResult Next()
{
return View();
}public ActionResult Index()
{
ViewBag.joy = "姓名:";
ViewBag.name = "丁小未";
ViewData["data"] = "大家来学学ASP.NET MVC4吧!";
return View();
}@{
ViewBag.Title = "Index";
}
<h2>我的信息</h2>
<a href="http://blog.csdn.net/dingxiaowei2013">学无止境的专栏</a>
<br/>
@ViewBag.joy
<br/>
@ViewBag.name
<br/>
@ViewData["data"]
如果我们运行其他的view也是可以的,访问HomeController下的NextAction视图
也可以访问其他控制器的Action视图
欢迎关注我的围脖
==================== 迂者 丁小未 CSDN博客专栏=================
MyBlog:http://blog.csdn.net/dingxiaowei2013 MyQQ:1213250243
Unity QQ群:375151422,858550,6348968 cocos2dx QQ群:280818155
====================== 相互学习,共同进步 ===================
Swift学习笔记四:数组和字典,布布扣,bubuko.com
标签:asp.net mvc4
原文地址:http://blog.csdn.net/xbenlang/article/details/29377799