コード例 #1
0
 internal void EnableGranularValidation(ValidateStringCallback validationCallback)
 {
     // Iterate over all the keys, adding each to the set containing the keys awaiting validation.
     // Unlike dictionaries, HashSet<T> can contain null keys, so don't need to special-case them.
     _keysAwaitingValidation = new HashSet <string>(Keys.Cast <string>(), StringComparer.OrdinalIgnoreCase);
     _validationCallback     = validationCallback;
 }
コード例 #2
0
ファイル: HttpValueCollection.cs プロジェクト: JianwenSun/cc
        /* 
         * We added granular request validation in ASP.NET 4.5 to provide a better request validation story for our developers.
         * Instead of validating the entire collection ahead of time, we'll only validate entries that are actually looked at.
         */

        internal void EnableGranularValidation(ValidateStringCallback validationCallback) {
            // Iterate over all the keys, adding each to the set containing the keys awaiting validation.
            // Unlike dictionaries, HashSet<T> can contain null keys, so don't need to special-case them.
            _keysAwaitingValidation = new HashSet<string>(Keys.Cast<string>().Where(KeyIsCandidateForValidation), StringComparer.OrdinalIgnoreCase);
            _validationCallback = validationCallback;

            // This forces CopyTo and other methods that cache entries to flush their caches, ensuring
            // that all values go through validation again.
            InvalidateCachedArrays();
        }
コード例 #3
0
        /*
         * We added granular request validation in ASP.NET 4.5 to provide a better request validation story for our developers.
         * Instead of validating the entire collection ahead of time, we'll only validate entries that are actually looked at.
         */

        internal void EnableGranularValidation(ValidateStringCallback validationCallback)
        {
            // Iterate over all the keys, adding each to the set containing the keys awaiting validation.
            // Unlike dictionaries, HashSet<T> can contain null keys, so don't need to special-case them.
            _keysAwaitingValidation = new HashSet <string>(Keys.Cast <string>().Where(KeyIsCandidateForValidation), StringComparer.OrdinalIgnoreCase);
            _validationCallback     = validationCallback;

            // This forces CopyTo and other methods that cache entries to flush their caches, ensuring
            // that all values go through validation again.
            InvalidateCachedArrays();
        }
コード例 #4
0
 internal void EnableGranularValidation(ValidateStringCallback validationCallback)
 {
     // Iterate over all the files, adding each to the set containing the files awaiting validation.
     // Unlike dictionaries, HashSet<T> can contain null keys, so don't need to special-case them.
     _filesAwaitingValidation = new HashSet <HttpPostedFile>();
     for (int i = 0; i < Count; i++)
     {
         _filesAwaitingValidation.Add((HttpPostedFile)BaseGet(i));
     }
     _validationCallback = validationCallback;
 }
コード例 #5
0
 internal void EnableGranularValidation(ValidateStringCallback validationCallback) {
     // Iterate over all the files, adding each to the set containing the files awaiting validation.
     // Unlike dictionaries, HashSet<T> can contain null keys, so don't need to special-case them.
     _filesAwaitingValidation = new HashSet<HttpPostedFile>();
     for (int i = 0; i < Count; i++) {
         _filesAwaitingValidation.Add((HttpPostedFile)BaseGet(i));
     }
     _validationCallback = validationCallback;
 }
コード例 #6
0
 internal void EnableGranularValidation(ValidateStringCallback validationCallback) {
     // Iterate over all the keys, adding each to the set containing the keys awaiting validation.
     // Unlike dictionaries, HashSet<T> can contain null keys, so don't need to special-case them.
     _keysAwaitingValidation = new HashSet<string>(Keys.Cast<string>(), StringComparer.OrdinalIgnoreCase);
     _validationCallback = validationCallback;
 }