Subtext.Web.Controls.Captcha.CaptchaInfo.ToEncryptedString C# (CSharp) Method

ToEncryptedString() public method

Returns a base 64 encrypted serialized representation of this object.
public ToEncryptedString ( ) : string
return string
        public string ToEncryptedString()
        {
            if (this.Width == 0)
                this.Width = 180;

            if (this.Height == 0)
                this.Height = 50;

            return CaptchaBase.EncryptString(this.ToString());
        }

Usage Example

Example #1
0
        public void CanRoundTripCaptchaInfo()
        {
            DateTime date = DateTime.ParseExact(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);

            CaptchaInfo info = new CaptchaInfo("My Test");
            info.WarpFactor = CaptchaImage.FontWarpFactor.High;
            info.DateGenerated = date;

            string encrypted = info.ToEncryptedString();
            Assert.IsTrue(encrypted.IndexOf("My Test") < 0);
            info = CaptchaInfo.FromEncryptedString(encrypted);
            Assert.AreEqual("My Test", info.Text);
            Assert.AreEqual(CaptchaImage.FontWarpFactor.High, info.WarpFactor);
            Assert.AreEqual(date, info.DateGenerated);
        }
All Usage Examples Of Subtext.Web.Controls.Captcha.CaptchaInfo::ToEncryptedString