I want to embed a URL in an applet parameter.
我想在applet参数中嵌入一个URL。
The only way I know to create automatically the URL is Html.ActionLink()
, but I want only the inner HREF
attribute, not the whole link.
我知道自动创建URL的唯一方法是Html.ActionLink(),但我只想要内部的HREF属性,而不是整个链接。
Is there another way to get what I wan't, other that using Regex
on the output of ActionLink()
to get the HREF
attribute?
是否有另一种方法可以获得我不想要的东西,其他方法是在ActionLink()的输出上使用Regex来获取HREF属性?
1 个解决方案
#1
49
To get only the URL, you can use Url.Action()
instead of Html.ActionLink()
.
要只获得URL,可以使用URL . action()而不是Html.ActionLink()。
It has a number of overloads, so you can give it the name of a route, or the name of the action and the controller, or a number of other options.
它有许多重载,所以您可以给它一个路由的名称,或者操作和控制器的名称,或者其他一些选项。
Example:
例子:
Url.Action("YourAction", "YourController")
#1
49
To get only the URL, you can use Url.Action()
instead of Html.ActionLink()
.
要只获得URL,可以使用URL . action()而不是Html.ActionLink()。
It has a number of overloads, so you can give it the name of a route, or the name of the action and the controller, or a number of other options.
它有许多重载,所以您可以给它一个路由的名称,或者操作和控制器的名称,或者其他一些选项。
Example:
例子:
Url.Action("YourAction", "YourController")