예제 #1
0
        public FormSecurityToken GetToken()
        {
            var r    = new Random(Guid.NewGuid().GetHashCode());
            var code = r.Next(999999, 99999999).ToString();
            //var token = "<input type=\"hidden\" name=\"{0}\" value=\"{1}\"/><input type=\"hidden\" name=\"{2}\" value=\"{3}\"/>";
            var result = new FormSecurityToken();

            result.Value.Name     = Config.TokenName;
            result.Value.Value    = code;
            result.Checksum.Name  = Config.EncryptedTokenName;
            result.Checksum.Value = _config.Encrypt(code);

            return(result);
        }
예제 #2
0
 public static string Render(this FormSecurityToken token)
 {
     return(token.Value.Render() + token.Checksum.Render());
 }