0

I want to use the Html Helper class to build, for example, an Html.ActionLink from within a controller action. I don't see it available from within controller actions. What am I missing?

1
  • Oh, I totally understand to resist using Html Helpers in the controllers... but what happens when I want logic to control which link is presented? Then I have to dump logic into my view. Same violation, different area. Commented Aug 14, 2009 at 21:55

2 Answers 2

1

Consider using UrlHelper @ Controller.Url. You can use it to generate a url, then pass it to your view. The view is the right place to create a link to the url.

Sign up to request clarification or add additional context in comments.

Comments

1

I don't think you should be using the html helper methods in your controller. This stuff is best left in the view

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.