Part 2 How are the URL's mapped to Controller Action Methods?
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?的更多相关文章
- (转) jsp页面 URL传中文参数到Action里面出现乱码
jsp页面 URL传中文参数到Action里面出现乱码,方法如下: 第一种:在Action中用 new String(str.getBytes("ISO8859_1"), &quo ...
- asp.net MVC中获取当前URL/Controller/Action
一.获取URL(ASP.NET通用): [1]获取完整url(协议名+域名+虚拟目录名+文件名+参数) string url=Request.Url.ToString(); [2]获取虚拟目录名+页面 ...
- Struts2中的链接标签 <s:url>和<s:a>---在action中获取jsp表单提交的参数(转)
转自:http://sgl124764903.iteye.com/blog/444183 1.普通链接 Web程序中最普通的应用是链接到其他页面,下面看Welcome.jsp. <%@ page ...
- ASP.NET MVC和ASP.NET Core MVC中获取当前URL/Controller/Action (转载)
ASP.NET MVC 一.获取URL(ASP.NET通用): [1]获取完整url(协议名+域名+虚拟目录名+文件名+参数) string url=Request.Url.ToString(); [ ...
- JS funtion()中URL不跳转后台action问题
JS funtion()中URL不跳转后台action问题 今天遇到一个百思不得其解的问题,到现在解决了,但是仍然不知道所以然(估计是因为域名不一致导致的),记录一下 $.get(actionUrl, ...
- yii2:Url::toRoute 和 ActiveForm::begin action在二级目录生成地址错误
yii2:Url::toRoute 和 ActiveForm::begin action在二级目录下生成地址错误. 正确地址: /www/super/web/wxreplay/edit-text?id ...
- url获取MVC域,action,controller的方法
域:filterContext.RequestContext.RouteData.DataTokens["area"] 控制器:filterContext.RequestConte ...
- 在动作方法中生成输出URL (Generating Outgoing URLs in Action Methods) |
- 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 ...
随机推荐
- CSS复合样式
关于font OK,我们先从font来谈起. 如下一段代码: div{ font-size: 14px; font-family: '\5FAE\8F6F\96C5\9ED1'; font-weigh ...
- 用java发送邮件(黄海已测试通过)
/** * java发送带附件的邮件 * 周枫 * 2013.8.10 */ package com.dsideal.Util; import javax.mail.*; import javax.m ...
- 理解reserve与resize
1.首先明白capacity与size的概念,capacity表示当前可以容纳多少个元素,size表示当前有多少个元素.为了避免频繁地分配内存,vector预留了一些内存.也就是说:size<= ...
- jQuery循环滚动新闻列表
最近由于项目原因,学习了下jquery,实现了一个小小的功能,就是点击公告的上一条下一条来查看滚动条.具体代码如下: <!DOCTYPE html PUBLIC "-//W3C//DT ...
- EasyUI-在iframe里获取现阶段选中的tab的标题
在iframe里获取当前选中的tab的标题(easyui) var currTab =$$('#tabs').tabs('getSelected'); console.info(currTab.pan ...
- DB2数据库性能优化介绍
DB2数据库性能优化介绍 作者:chszs,转载需注明.博客主页:http://blog.csdn.net/chszs 前段时间,我从CSDN得到了这本书<DB2数据库性能调整和优化(第2版)& ...
- [Express] Level 4: Body-parser -- Delete
Response Body What would the response body be set to on a DELETE request to /cities/DoesNotExist ? H ...
- iOS 在类实现定义中声明成员变量的怪异方式
WebGL 规范(WebGL Specification) 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致&quo ...
- SQL SERVER中查找某关键词位于哪些存储过程或函数
USE [MYDB] go SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_type='PROCEDURE' AND routine_d ...
- angularJs项目实战!02:前端的页面分解与组装
自从上一篇文章到现在已经有将近一个月的时间,我将精力放在了前端页面分解与组装,和angularjs如何与jquery.bootstrap.D3等一系列其他类库结合使用的经验总结上.由于公司新招了一些员 ...