I received the encoded querystring which include ASCII Char 0 (http://localhost/Test_Authentication.asp?token=%13%23%02%00%01%01%00%01%01%05%02%02%03%00%02%02%0A%0A%0A%0A%0A%0A048
) and when I retrieve the value the string is terminated that position (%00
). How should I fix this problem?
The following is my code.
Response.CharSet = "utf-8";
Session.CodePage=65001;
var strToken = (Request.QueryString("token").Count > 0)?Request.QueryString("token")(1):"";
%00 is ascii for null character. I suspect this is why the string is being terminated at this point.
I would suggest using a different format or method for your creating your hashed token, perhaps one that creates it as a hexidecimal value instead, e.g.;
B73A21FBCE3921E5DD0C935AB4D710DD
An MD5 hash is typically expressed as a 32-digit hexadecimal number. This will be far more friendly for passing around in querystring.