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?的更多相关文章

  1. (转) jsp页面 URL传中文参数到Action里面出现乱码

    jsp页面 URL传中文参数到Action里面出现乱码,方法如下: 第一种:在Action中用 new String(str.getBytes("ISO8859_1"), &quo ...

  2. asp.net MVC中获取当前URL/Controller/Action

    一.获取URL(ASP.NET通用): [1]获取完整url(协议名+域名+虚拟目录名+文件名+参数) string url=Request.Url.ToString(); [2]获取虚拟目录名+页面 ...

  3. Struts2中的链接标签 <s:url>和<s:a>---在action中获取jsp表单提交的参数(转)

    转自:http://sgl124764903.iteye.com/blog/444183 1.普通链接 Web程序中最普通的应用是链接到其他页面,下面看Welcome.jsp. <%@ page ...

  4. ASP.NET MVC和ASP.NET Core MVC中获取当前URL/Controller/Action (转载)

    ASP.NET MVC 一.获取URL(ASP.NET通用): [1]获取完整url(协议名+域名+虚拟目录名+文件名+参数) string url=Request.Url.ToString(); [ ...

  5. JS funtion()中URL不跳转后台action问题

    JS funtion()中URL不跳转后台action问题 今天遇到一个百思不得其解的问题,到现在解决了,但是仍然不知道所以然(估计是因为域名不一致导致的),记录一下 $.get(actionUrl, ...

  6. yii2:Url::toRoute 和 ActiveForm::begin action在二级目录生成地址错误

    yii2:Url::toRoute 和 ActiveForm::begin action在二级目录下生成地址错误. 正确地址: /www/super/web/wxreplay/edit-text?id ...

  7. url获取MVC域,action,controller的方法

    域:filterContext.RequestContext.RouteData.DataTokens["area"] 控制器:filterContext.RequestConte ...

  8. 在动作方法中生成输出URL (Generating Outgoing URLs in Action Methods) |

  9. Part 1 some difference from asp.net to asp.net mvc4

    Part 1 some difference from asp.net to asp.net mvc4 In MVC URL's are mapped to controller Action Met ...

随机推荐

  1. 【剑指offer】顺时针打印矩阵

    转载请注明出处:http://blog.csdn.net/ns_code/article/details/26053049 剑指offer上的第20题,九度OJ上測试通过. 题目描写叙述: 输入一个矩 ...

  2. Codeforces Gym 100463B Music Mess Hash 逻辑题

    Music Mess Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100463/attachments ...

  3. Linux磁盘及文件系统管理 4---- Linux文件系统挂载管理

    1 挂载操作 1 磁盘或者分区需要创建好文件系统后,需要挂载到一个目录才能够使用 2 windows或者是Mac会自动的挂载文件系统,一旦创建好文件系统后会自动的挂载 3 对于Linux来说我们必须要 ...

  4. [Angular2 Router] CanActivate Route Guard - An Example of An Asynchronous Route Guard

    In this tutorial we are going to learn how we can to configure an can activate route guard in the An ...

  5. Android下用Properties保存程序配置

    读写函数分别例如以下: import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Proper ...

  6. Mip-Mapping很重要

    MipMap这个东东,记得我除了最早在DX9龙书上了解了其基本概念后,以后便再没接触过,因为从创建到使用都是硬件一手包办,所以这个知识点很容易被遗忘和忽视.这几天空闲时恰好发现了一点MipMap引起的 ...

  7. Android获取网页上的图片的代码

    public Bitmap getWebBitmap(String imgUrl) { Bitmap bitmap =null; try { InputStream inputStream = nul ...

  8. HTTP权威指南学习心得

    一.HTTP请求的步骤: 1.从url中读取主机名 2.利用DNS(domain name service)对主机名进行转换,得到IP地址 3.如果有端口号的话,读取端口号 4.根据IP地址和端口号, ...

  9. Entity Framework 使用注意:Where查询条件中用到的关联实体不需要Include

    来自博客园开发团队开发前线最新消息: 在Entity Framework中,如果实体A关联了实体B,你想在加载实体A的同时加载实体B.通常做法是在LINQ查询中使用Include().但是,如果你在查 ...

  10. framework&&library's root

    框架和文件集合的路径应该是相对路径而不是绝对路径 写法如下图所示: