#region 解加密過的參數
private static string decode(String strData)
{
try { return System.Text.UTF8Encoding.UTF8.GetString(System.Convert.FromBase64String(strData)); }
catch { return ""; }
}
private static Hashtable QueryValue(string _do)
{
_do = decode(_do);
string[] s = _do.Split('&');
Hashtable ht = new Hashtable();
for (int i = 0; i < s.Length; i++)
{
if (s[i].IndexOf("=") > 0)
{
string key = "";
string values = "";
key = s[i].Substring(0, s[i].IndexOf("="));
values = s[i].Substring(s[i].IndexOf("=") + 1);
ht.Add(key, values);
}
}
return ht;
}
public static string GetQueryStringByKey(string pKey, string queryString)
{
Hashtable do_ht = QueryValue(queryString);
return do_ht.ContainsKey(pKey) ? do_ht[pKey].ToString() : "";
}
#endregion
#region 加密
private static string encode(String strData)
{
try { return System.Convert.ToBase64String(System.Text.UTF8Encoding.UTF8.GetBytes(strData)); }
catch { return ""; }
}
public static string GetCustNe(string pCustomerName)
{
return "?_do=" + encode("CustNe=" + pCustomerName);
}
#endregion
參考資料:http://www.dotblogs.com.tw/joumingt/archive/2009/07/09/9271.aspx