Custom validator validating multiple controls
When the value of the form field is redisplayed, the script steals information from the page and sends the information to the hacker.For example, because users typically select their own user names, you should always HTML encode user names that you display in a view like this: *** Begin Note *** The ASP.
· protocol – The protocol for the link (for example, https) · hostname – The host name for the link (for example, Notice that you can pass route values from an Html. For example, you might need to pass the Id of a database record that you want to edit. The view renders an HTML page with a simple user registration form (see Figure 2). If you prefer, you could create the view in Listing 2 without using any of these helpers. Validation Summary — in Chapter 8, Validating Form Data.Here’s how you pass an Id parameter to the Edit() action: [C#] *** Begin Note *** Route values are URL encoded automatically. Figure 2 – The Register page *** Begin Note *** You might have noticed that Listing 2 includes validation helpers. *** End Note *** In Listing 2, the opening and closing · route Values — The set of values passed to the action.· data Text Field – The name of the property to display for each item in the Select List as the label of the item.· selected Value – The item to select in the Select List.