When we are developing our views, we can set codes as HTML.Helpers or write them as HTML tags.
However what’s best ?
EXAMPLE: CREATING A HYPERLINK
1. @Html.ActionLink("About this Website", "About")
2. <a href="/Home/About">About this Website</a>
a) So what should I use ? Should I write the HTML tags directly without razor or use helpers ?
b) If I use helperss would it cause an extra processing once I have to convert Razor to HTML ?
You can choose either. I personally use both, depending to where I’m linking.
For members and registered users, on an ASP.net project, I usually use the helpers, and on any pages accessible to unauthenticated users I use the <a href=""></a> tags.
If you use the Html.ActionLink helper, the url will always be constructed properly regardless of changes in the hosting environment, or changes between development, testing and production environments. This might not be an issue to you in which case feel
free to hard code your links.
I have full control over my hosting environment and make sure that the development environment mirrors it as much as possible. Despite that, I use the helpers just in case.
If I use helperss would it cause an extra processing once I have to convert Razor to HTML ?
Yes, but it is so insignificant that if you have to worry about it, you have much bigger problems.