是什么在ASP.NET MVC RouteLink和ActionLink的区别呢? [英] What's the difference between RouteLink and ActionLink in ASP.NET MVC?

查看:807
本文介绍了是什么在ASP.NET MVC RouteLink和ActionLink的区别呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得标题pretty的多总结起来:

I think that the title pretty much sums it up:

什么是在ASP.NET MVC?

What's the difference between RouteLink() and ActionLink() in ASP.NET MVC?

即。当你使用 Html.RouteLink(),当你使用 Html.ActionLink()的看法?

i.e. when do you use Html.RouteLink() and when do you use Html.ActionLink() in your View?

推荐答案

动作和路线不必有一个1:1的关系

Action and Routes don't have to have a 1:1 relationship.

ActionLink的将生成的URL使用第一个匹配的路由通过动作名称去的动作。

ActionLink will generate the URL to get to an action using the first matching route by action name.

RouteLink会生成一个URL到一个特定的路由决定按名称或路径的值。

RouteLink will generate a URL to a specific route determined either by name or route values.

这篇关于是什么在ASP.NET MVC RouteLink和ActionLink的区别呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆