Tutorial by Topics: html



The anti-forgery token can be used to help protect your application against cross-site request forgery. To use this feature, call the AntiForgeryToken method from a form and add the ValidateAntiForgeryTokenAttribute attribute to the action method that you want to protect.

Generates a hidden form field (anti-forgery token) that is validated when the form is submitted.

HTML helpers are methods used to render HTML elements in a view. They are part of the System.Web.Mvc.HtmlHelper namespace.

There are different types of HTML helpers:

Standard HTML Helpers: They are used to render normal HTML elements, e.g. Html.TextBox().

Strongly Typed HTML Helpers: These helpers render HTML elements based on model properties, e.g. Html.TextBoxFor().

Custom HTML Helpers: The user can create custom helper method which returns MvcHtmlString.

CSS provides styles to HTML elements on the page. Inline styling involves usage of the style attribute in tags, and is highly discouraged. Internal stylesheets use the <style> tag and are used to declare rules for directed portions of the page. External stylesheets may be used through a <link> tag which takes an external file of CSS and applies the rules to the document. This topic covers usage of all three methods of attachment.

As with web development, it's good to provide some reset CSS to the emails. As when building a web page, adding a CSS reset to an email helps to normalize how the code gets rendered across multiple email clients (since each has it's own default styles and way of interpreting code).

Html helpers are a very useful way of creating html elements in views using MVC framework. With a bit of time your team can really benefit from using them. It helps with keeping the code clean and error prone.


Page 1 of 2