コード例 #1
0
ファイル: InputExtensions.cs プロジェクト: saeidmh83/MyCMS
        public static MvcHtmlString EncryptedHidden(this HtmlHelper helper, string name, object value)
        {
            if (value == null)
            {
                value = string.Empty;
            }
            var strValue = value.ToString();
            IEncryptSettingsProvider settings = new EncryptSettingsProvider();
            var encrypter      = new RijndaelStringEncrypter(settings, helper.GetActionKey());
            var encryptedValue = encrypter.Encrypt(strValue);

            encrypter.Dispose();

            var encodedValue = helper.Encode(encryptedValue);
            var newName      = string.Concat(settings.EncryptionPrefix, name);

            return(helper.Hidden(newName, encodedValue));
        }
コード例 #2
0
        private IRijndaelStringEncrypter GetDecrypter(System.Web.Routing.RequestContext requestContext)
        {
            var decrypter = new RijndaelStringEncrypter(_settings, requestContext.GetActionKey());

            return(decrypter);
        }