asp.net encrypt cookie value

wayak

New Member
I'm having some trouble encrypting cookie values in asp. Is there a semi easy way of encrypting and decrypting cookie values? I am currently using this to set the cookie:\[code\] Protected Sub LoginUser_LoggedIn(sender As Object, e As System.EventArgs) Handles LoginUser.LoggedIn Dim UserName As TextBox = DirectCast(LoginUser.FindControl("UserName"), TextBox) Dim UserNameCookie As New HttpCookie("Username") Response.Cookies.Add(UserNameCookie) UserNameCookie.Secure = True UserNameCookie.HttpOnly = True UserNameCookie.Expires = DateTime.Today.AddYears(1) UserNameCookie.Value = http://stackoverflow.com/questions/14459665/UserName.TextEnd Sub\[/code\]
 
Back
Top