Click here to Skip to main content
16,020,669 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I try encode and decode with query string.
it's successful run on local host. but when I have upload project on server.
that time not receive value on decode page with query string.

Thanks,
Pinank,
Posted
Comments
Karthik Harve 14-Jul-12 1:48am    
How are you encrypting the string? can you show your code?
Pratham4950 14-Jul-12 6:34am    
Encoding

public static string Base64EncodingMethod(string sData)
{

byte[] encodingDataASBytes = System.Text.Encoding.Unicode.GetBytes(sData);

string sReturnValues = System.Convert.ToBase64String(encodingDataASBytes);

return sReturnValues;

}


TextBox1.Text = Base64EncodingMethod(clientcode.ToString());
Application["clientcode"] = TextBox1.Text;

Decoding

public static string Base64DecodingMethod(string sData)
{

byte[] encData = System.Convert.FromBase64String(sData);
string result = System.Text.ASCIIEncoding.ASCII.GetString(encData);
return result;
}


txtclientcode.Text = Request.QueryString["clientcode"];
TextBox1.Text = Base64DecodingMethod(txtclientcode.Text.ToString());
Suvabrata Roy 14-Jul-12 1:50am    
Code required ...

Please provide your code
deepakdynamite 14-Jul-12 2:17am    
Which algorithm is are using for encoding and decoding ?
Sandeep Mewara 14-Jul-12 5:07am    
This is not a well framed question! We cannot work out what you did from the post. Please elaborate.
Use the "Improve question" link to edit your question and provide better information.

1 solution

Re write your method following way...

In Parent Page Encode query string this way

public static sting Encode(string sData)
{
return HttpUtility.UrlEncode(sData);
}

Now pass this encoded query string to your parent page & on Parent page decode that query string by following function. I assume that encoded query string name is sData & its passed from parent page to child page

public static string Decode()
{
string dSData = HttpUtility.UrlDecode(Request.QueryString["sData"].ToString());
return dsData;
}

I think you have idea about how to pass query string from parent to child page
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900