ASP.NET - 对URL传递的值进行编码Server.UrlEncode()
/// <summary> /// 搜索内容 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSearch_Click(object sender, EventArgs e) { string key = txtSearch.Text.Trim(); string action = this.radTitle.Checked ? "byTitle" : "byContent"; Response.Redirect("~/NewsSearch.aspx?key=" + Server.UrlEncode(key) + "&action=" + action + ""); }
posted on 2015-07-09 11:09 ultrastrong 阅读(704) 评论(0) 编辑 收藏 举报