Connecting Tech Pros Worldwide Forums | Help | Site Map

Cookie value different after adding via Response.Appendcookie

quintesv via DotNetMonster.com
Guest
 
Posts: n/a
#1: Dec 12 '06
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?

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200612/1

Cowboy \(Gregory A. Beamer\)
Guest
 
Posts: n/a
#2: Dec 12 '06

re: Cookie value different after adding via Response.Appendcookie


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!
********************************************
"quintesv via DotNetMonster.com" <u26933@uwewrote in message
news:6aa58456648b4@uwe...
Quote:
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?
>
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200612/1
>
quintesv via DotNetMonster.com
Guest
 
Posts: n/a
#3: Dec 20 '06

re: Cookie value different after adding via Response.Appendcookie


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).



Cowboy (Gregory A. Beamer) wrote:
Quote:
>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.
>
Quote:
>Hi all,
>>
>[quoted text clipped - 33 lines]
Quote:
>it
>works on winxp sp2?
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200612/1

Closed Thread