ASP.NET Server.UrlEncode 將 URL 字串轉成 URL 編碼
WebForm2.aspx.cs |
protected void Page_Load(object sender, EventArgs e) { Label1.Text = "<a href='http://localhost:3064/WebForm2.aspx?id=" Label1.Text += Server.UrlEncode("A B C < > & ' \" 1 1 1 1") + "'>Link</a><br />"; if (Request.QueryString["id"] != null) { Label2.Text = Request.QueryString["id"].ToString().Trim(); } } |