some characeter problem

  • Thread starter Thread starter Jason Huang
  • Start date Start date
J

Jason Huang

Hi,

In my C# Net I have a string after encrypting as:
LVp0XG2enhBUFifY+41kQ
In my ASPNet I want to do something is the IE6 browser:
http://MyIP/MyWeb.aspx?TestNo=LVp0XG2enhBUFifY+41kQ
and my C# program will decrypt the "LVp0XG2enhBUFifY+41kQ" to a real number.
However, the "+" in the "LVp0XG2enhBUFifY+41kQ" just appears as a space so
my
program can't decrypt correctly.
Would someone give me some advice?
Thanks for help.


Jason
 
Jason said:
Hi,

In my C# Net I have a string after encrypting as:
LVp0XG2enhBUFifY+41kQ
In my ASPNet I want to do something is the IE6 browser:
http://MyIP/MyWeb.aspx?TestNo=LVp0XG2enhBUFifY+41kQ
and my C# program will decrypt the "LVp0XG2enhBUFifY+41kQ" to a real number.
However, the "+" in the "LVp0XG2enhBUFifY+41kQ" just appears as a space so
my
program can't decrypt correctly.
Would someone give me some advice?
Thanks for help.

Jason

You have to encode the value properly.

Use the Server.UrlEncode method to encode values to put in an url.
 
Hi,

In my C# Net I have a string after encrypting as:
LVp0XG2enhBUFifY+41kQ
In my ASPNet I want to do something is the IE6 browser:
http://MyIP/MyWeb.aspx?TestNo=LVp0XG2enhBUFifY+41kQ
and my C# program will decrypt the "LVp0XG2enhBUFifY+41kQ" to a real number.
However, the "+" in the "LVp0XG2enhBUFifY+41kQ" just appears as a space so
my
program can't decrypt correctly.
Would someone give me some advice?
Thanks for help.


Jason

Server.UrlEncode and Server.UrlDecode are your friends when it comes
to representing characters in URLs
 
I use the Request.Url.ToString() method, cuz when I use the Server.UrlEncode
method,
there will have some '%' in my TestNo.
 
I use the Request.Url.ToString() method, cuz when I use the Server.UrlEncode
method,
there will have some '%' in my TestNo.

The whole point of using Server.UrlEncode is to get the %s in there.
Then when you use Server.UrlDecode they should be removed, so you'll
have your original text again.

Jon
 
Jon said:
The whole point of using Server.UrlEncode is to get the %s in there.
Then when you use Server.UrlDecode they should be removed, so you'll
have your original text again.

Jon

Only, you don't use Server.UrlDecode yourself. That is done
automatically when the values are put in the Request.QueryString
collection. :)
 
Back
Top