FormsAuthentication.Encrypt and Decrypt not playing nicely

G

Guest

We want to use FormsAuthenticationTickets as part of our ASP.NET security.
The current design stores the user's ticket in the db, and later uses the
ticket to extract other data from the database. When the user logs out, we
use the ticket to delete the ticket from the db, using the encrypted ticket
as the key.

Problem is, the tickets don't seem to match between being encrypted and then
decrypted. For example, the following returns two totally different results.

string encryptedTicket = FormsAuthentication.Encrypt(ticket);
System.Diagnostics.Debug.WriteLine(encryptedTicket);
FormsAuthenticationTicket anotherTicket =
FormsAuthentication.Decrypt(encryptedTicket);
encryptedTicket = FormsAuthentication.Encrypt(anotherTicket);
System.Diagnostics.Debug.WriteLine(encryptedTicket);

The two debugs product totally different results. This totally blows our
design. Why don't they match?

Thanks
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top