asp.net form validation new ideas

  • 2020-05-07 19:30:47
  • OfStack

Brief description: randomly verify a certain item or several items. Reduce the validation effort.
public static int IntRound(int Max) 
{ 
Random r = new Random(); 
int i = r.Next(0, Max); 
r = null; 
return i; 
} 

 
int i=IntRound(8); 
if (Request.Form["txt" + i] != "") 
{ 
} 

This can also be done (however, be aware of other non-normal form items)
 
if (Request.Form[i] != "") 
{ 
} 

Related articles: