C# 将网址转换为16进制可用网址,防盗链,%%

string netName = this.TextBox1.Text.ToString().Trim();

char[] charNet = netName.ToCharArray();
string Hstr = null;
for (int i = 0; i < charNet.Length; i++)
{
    Hstr += "%" + ((int)charNet[i]).ToString("X");
}

string ss = string.Format("<script>window.open('http://{0}')</script>",Hstr);

this.Response.Write(ss);

//防君子不防小人

posted @ 2009-02-08 09:52  binlunia  阅读(198)  评论(0编辑  收藏  举报