//對網(wǎng)址進行UrlEncode編碼,接收后再進行URLDecode解碼
public static string UrlEncode(string str)
{
string tmpStr = "";
if (str != "" && str != null)
{
StringBuilder sb = new StringBuilder();
byte[] byStr = System.Text.Encoding.UTF8.GetBytes(str);
for (int i = 0; i < byStr.Length; i++)
{
sb.Append(@"%" + Convert.ToString(byStr[i], 16));
}
tmpStr = sb.ToString();
}
return (tmpStr);
}