您的位置:首页 > 编程语言 > ASP

ASP.NET - 对URL传递的值进行编码Server.UrlEncode()

2015-07-09 11:09 721 查看
/// <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 + "");
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: