I need to have links which will point to other website web pages. Currently I am using the following method.
<a href="@reseller.Url">Product-Page</a>
I was wondering if i can use ActionLink for the same. Or ActionLink is just for in-house action methods ? Do I have other better choices or my above usage is correct for the requirement
The
ActionLinkmethod is strictly for “Action Methods”, which are methods in a controller that return anActionResult.Your above usage is correct.
If you wish to wrap the entire link creation process, you could create your own helper method on the
HtmlHelperclass to do this.This answer shows an example of creating an HTML helper for image links:
Is there an ASP.NET MVC HtmlHelper for image links?
Yours would probably be simpler, if you do choose to write a helper.