How can I use mailto in a MVC Html.ActionLink? [closed]
-
28-09-2019 - |
Question
I am currently moving a site over to MVC with great success, but I have a couple of pages which have a mailto
link on them. Is there a way to get this to work with Html.ActionLink
?
Solution
Html.ActionLink
is meant to do just that, render a link to an action method URL; a mailto:
link is a special case, a pseudo-protocol which is acted upon by the client's browser.
Just use a straight HTML anchor tag in your view, there's nothing wrong with doing that.
OTHER TIPS
<a href="mailto:email@samplemeail.com?Subject=subject">LinkText</a>
With MVC model
<a href="mailto:@Model.Email">E-mail</a>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow