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 阅读(717) 评论(0) 收藏 举报
浙公网安备 33010602011771号