首页 > 移动平台 > 详细

Part 2 How are the URL's mapped to Controller Action Methods?

时间:2015-10-05 18:08:54      阅读:147      评论:0      收藏:0      [点我收藏+]

Part 2 How are the URL‘s mapped to Controller Action Methods?

The answer is ASP.NET Routing.Notice that in Global.asax we have RegisterRoutes().

技术分享

and press F12 go to the defination of this Method.

技术分享

ASP.NET MVC will automatically pass any query string or form post parameters named "name" to index action method when it is invoked.

public string Index(string id,string name)
{
    return "Id="+id+" Name="+name;
}
public string Index(string id)
{
    return "Id="+id+" Name="+Request.QueryString["name"];
}

 

Part 2 How are the URL's mapped to Controller Action Methods?

原文:http://www.cnblogs.com/gester/p/4777494.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!