Cookie value different after adding via Response.Appendcookie

  • Thread starter Thread starter quintesv via DotNetMonster.com
  • Start date Start date
Q

quintesv via DotNetMonster.com

Hi all,

On WinXP, VS 2003, .net 1.1

I have written an encryption class which uses rijndael method to encrypt a
string AND then convert the string to unicode using System.Text.
Unicodeencoder.

I then write this encrpyted string as follows:
//c is HTTPCookie

c.Values.Add("ValueString",sEncryptedString);
Response.AppendCookie(c2);

This results in the asp.net tracer outputting
For the Value described above:
Num Bytes : 16
String : 㺎旖犗?Ȭꂼ꿣谭

When reading this cookie in the Application_AuthenticateRequest sub it also
outputs as above. 16 Bytes. Same string build from the characters above..

However doing the above on a win2003 machine hosting the web project, the
tracer output shows the value in the cookie as blocks , ie, non displayable
characters. but when reading the cookie again the BYTES are 42 and the string
is double the size and consists of garbage.

note that im using the unicodeencoder.getbytes and getbytelength to determine
the lenght of the string in bytes.

Why is this not working when hosting the project on a Win2003 machine but it
works on winxp sp2?
 
Sounds like an ASCII/Unicode problem. I am not sure how to solve it,
however. I have, in the past, had to clip off the end of a string. I ended
up figuring out the problem in the encryption algorithm, but I do not
remember what it was. One option is to set up a Virtual machine with Windows
2003 and Visual Studio and play with your algorithm. You can then compare
the results on XP, just to be safe. Worst case is a factory that pulls an
encryption algorithm based on OS.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

********************************************
Think outside the box!
********************************************
 
Thanks cowboy,

that does seem to be the problem, but the exact code that I run in the
AuthenticateRequest event to decode the password WORKS when i place it in a
page_load for anywhere else. Its just in the Application_AuthenticateRequest
event. Strange eh?

So I'm pretty sure its not the code of the encryption (rijndael method).


Sounds like an ASCII/Unicode problem. I am not sure how to solve it,
however. I have, in the past, had to clip off the end of a string. I ended
up figuring out the problem in the encryption algorithm, but I do not
remember what it was. One option is to set up a Virtual machine with Windows
2003 and Visual Studio and play with your algorithm. You can then compare
the results on XP, just to be safe. Worst case is a factory that pulls an
encryption algorithm based on OS.
[quoted text clipped - 33 lines]
it
works on winxp sp2?
 
Back
Top