类似百度 http://www.baidu.com/s?wd=abc%B0%A1%C5%B6&n=2
搜索内容是 "abc啊哦"%B0%A1%C5%B6是 "啊哦" 吧?
"啊哦" 与 %B0%A1%C5%B6 怎么相互转换呢?无里头呀,我要百度啥才能知道.....
搜索内容是 "abc啊哦"%B0%A1%C5%B6是 "啊哦" 吧?
"啊哦" 与 %B0%A1%C5%B6 怎么相互转换呢?无里头呀,我要百度啥才能知道.....
{
public static string Encrypt(string filename)
{
byte[] buffer = HttpContext.Current.Request.ContentEncoding.GetBytes(filename);
return HttpUtility.UrlEncode(Convert.ToBase64String(buffer));
}
public static string Decrypt(string encryptfilename)
{
byte[] buffer = Convert.FromBase64String(encryptfilename);
return HttpContext.Current.Request.ContentEncoding.GetString(buffer);
}
}
用的时候
string url = FileHelper.Encrypt("data.mdb");//先加码
接受的时候
string filename = FileHelper.Decrypt(Request["fn"]); //通过解码得到文件名
后台:Server.UrlEncode,Server.UrlDecode
HttpUtility.UrlDecode("")