Reputation: 1615
When storing a value in a cookie using C#, what is the best way to encode (or escape) the value so that it can be retrieved and decoded/unescaped reliably?
I'm not talking about encryption.
Upvotes: 13
Views: 13067
Reputation: 8018
Well, the safest thing to do is use UrlEncoding (use HttpServerUtility.UrlEncode).
Upvotes: 17