문제

I want to embed a URL in an applet parameter.

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.

Is there another way to get what I wan't, other that using Regex on the output of ActionLink() to get the HREF attribute?

도움이 되었습니까?

해결책

To get only the URL, you can use Url.Action() instead of 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")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top