string wd = TextBox1.Text.Trim(); wd = HttpUtility.UrlEncode(wd, Encoding.Default); Response.Write("<script>window.open('http://www.baidu.com/s?wd= " + wd + "&cl=3')</script>");