MS Exam 70-536 - How can you limit the input before writing any code?

At MS Exam 70-536.Net Foundation , Chapter 3, “Searching, Modifying, and Coding Text” in Case 1 Script

Your organization, Northwind Traders, is creating a web application that allows customers to enter their contact information into your database. As a new employee, you have a simple task: create an interface and prepare user input that will be stored in the database ...

the question arises:

How can you limit the input before writing any code?

I thought it might be the design of a smart regex pattern, but it really won't limit the input, right? I'm not so good at psychokinesis yet!

Or maybe this is some other way?

+3
source share
4 answers

I noticed that there are answers at the end of the book :)

Answer. You can use separate ASP.NET RegularExpressionValidator controls to restrict input for each of the three fields. For the company name validator, set the ValidationExpression property to "[a-zA-Z ' -´\s]{1,40}". For the contact name validator, you can use the regular expression, "[a-zA-Z'-Ã, Â' \ s] {1,30}." Finally, for the phone number validator, you can use the ASP.NET built-in regular expression, "((((\ d {3})?) | (\ D {3} -))? \ D {3} - \ d {4 } ".

However, I believe that this is not correct, the knowledge requirements

, Microsoft Visual Basic # :
■ Microsoft Visual Studio Visual Basic #.
■ .
■ .

0

?

TextBox ( , Windows Forms) , . , MaxLength . CharacterCasing .

, , MaskedTextBox, DateTimePicker NumericUpDown, , (DateTime Decimal).

+8

, StringInputValidators........ ....

[ConfigurationProperty("lastUser", DefaultValue = "User", IsRequired = true)]
[StringValidator(InvalidCharacters  = ""!@#$%^&")] // and etc
public string LastUser
{   // get and set accessor code logic in here. }

, , , . "" ofc, , VS, atttributes, . , .

+2

Two things that immediately come to mind either limit the character set or add control restrictions to the database.

The question is fuzzy, and the answer to this question may depend on where the validation should be performed, what technologies are used, and, frankly, what is the definition of "code". For example, does it create a custom type that embeds constraints like "code"? Does HTML count if it is a web application? Client-side Javascript?

+1
source

Source: https://habr.com/ru/post/1736862/


All Articles