public AntiForgeryToken Deserialize(string serializedToken)
        {
            try
            {
                using (
                    MemoryStream stream = new MemoryStream(_cryptoSystem.Unprotect(serializedToken))
                    )
                {
                    using (BinaryReader reader = new BinaryReader(stream))
                    {
                        AntiForgeryToken token = DeserializeImpl(reader);
                        if (token != null)
                        {
                            return(token);
                        }
                    }
                }
            }
            catch
            {
                // swallow all exceptions - homogenize error if something went wrong
            }

            // if we reached this point, something went wrong deserializing
            throw HttpAntiForgeryException.CreateDeserializationFailedException();
        }
        public AntiForgeryToken?Deserialize(string serializedToken, bool throwOnError)
        {
            AntiForgeryToken?token = DeserializeImpl(serializedToken);

            if (token is null &&
                throwOnError)
            {
                throw HttpAntiForgeryException.CreateDeserializationFailedException();
            }

            return(token);
        }
 public AntiForgeryToken Deserialize(string serializedToken)
 {
     try
     {
         using (MemoryStream memoryStream = new MemoryStream(this._cryptoSystem.Unprotect(serializedToken)))
         {
             using (BinaryReader binaryReader = new BinaryReader(memoryStream))
             {
                 AntiForgeryToken antiForgeryToken = AntiForgeryTokenSerializer.DeserializeImpl(binaryReader);
                 if (antiForgeryToken != null)
                 {
                     return(antiForgeryToken);
                 }
             }
         }
     }
     catch
     {
     }
     throw HttpAntiForgeryException.CreateDeserializationFailedException();
 }