troubleshooting Question

Issue with Cookies and Character Encoding, from ASP.NET to classic ASP

Avatar of universalglove
universalgloveFlag for United States of America asked on
2 Comments1 Solution1865 ViewsLast Modified:
I'm having an issue with a classic ASP forum that I'm trying to convert to work beneath an ASP.NET website. I'm using .NET Membership for storing user accounts and logging users in. Upon logging in, I write a cookie that saves the username and encrypted password, straight out of the database, for use by the forum. (I'm utilizing the same mechanism the forum itself already used; just having .NET handle logins and writing the cookie, and disabling all parts of the forum that handled that, i.e. rewriting them to only check credentials against the values in the cookie).

With one user (my primary administrative user, as luck would of course have it), I can't make the forum authenticate.
I can interact just fine with the forum as other users. I've tested the code itself piece by piece, and finally narrowed it down to the one difference: the password's encrypted value for the one user contains + signs. (They all contain = signs at the end of the encrypted password, and those are not a problem apparently.)
• When I view the cookie, from a .NET or classic ASP page, the password is proper - contains the +s.
• When I write the value that the classic ASP pages grab from the cookie, the +s are missing. They are not square boxes, as I'd expect - just spaces.
• I copy that value and paste it in my text editor, and it sees them the same as other spaces.
• If I try changing the encoding in my text editor, the +s do not show up.
• The .NET pages were originally UTF-8; the classic ASP pages were originally Windows-1252.
• If I change the encoding of the classic ASP pages to UTF-8 (using <meta charset="">), no change in the cookie value - though there are changes in the rest of the text on the page.
• If I set Response.Charset="UTF-8", no change.
• I can see the +s in the database. That and the fact that .NET is writing them to the database makes me assume they're stored as UTF-8.
• Session.LCID=1033, if that matters or affects anything.

How can I get classic ASP to read the cookie values properly?
Request.Cookies doesn't do something to their values, does it?
I'm currently looking to see if there's a way I can forcibly, in code, say "grab this value as UTF-8!".

I hate messing with character encoding. It always seems like it's controlled from too many places, and no matter how much I try, if it doesn't just magically work out, I can never get it to. Even when I do, then that usually just means Internet ****ing Explorer messes up somehow. And I don't have anyone that I can just ask to look over it all and point out to me how each piece of the machinery handles the value along the way - SQL Server, Windows server, the ASP itself, and then the client browser. And this sort of problem always ends up sucking up tons of time on something I didn't need to be spending the time on, usually with only extreme workaround solutions (like, "don't use that forum").
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros