{"id":2505,"date":"2014-07-11T10:44:39","date_gmt":"2014-07-11T02:44:39","guid":{"rendered":"http:\/\/kuki.idv.tw\/?p=2505"},"modified":"2014-07-11T10:44:39","modified_gmt":"2014-07-11T02:44:39","slug":"%e8%bd%89-net-querystring-%e7%9a%84%e9%82%a3%e4%ba%9b%e4%ba%8b","status":"publish","type":"post","link":"https:\/\/www.kuki.idv.tw\/?p=2505","title":{"rendered":"[\u8f49][.NET] QueryString \u7684\u90a3\u4e9b\u4e8b"},"content":{"rendered":"<p style=\"color: #000000;\">\u4f86\u6e90 http:\/\/www.dotblogs.com.tw\/marcus116\/archive\/2012\/07\/29\/73690.aspx<\/p>\n<p style=\"color: #000000;\">\n<p style=\"color: #000000;\"><span style=\"color: #0000ff; font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><strong style=\"color: #336699 !important;\">\u524d\u8a00<\/strong><\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">Querystring\u662fASP.NET\u72c0\u614b\u7ba1\u7406\uff08ASP.NET State Management\uff09\u6a5f\u5236\u4e2d\u5e38\u7528\u5230\u7684\u50b3\u905e\u8cc7\u6599\u65b9\u5f0f\u4e4b\u4e00<\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u76f8\u4fe1\u6bcf\u500bASP.NET\u958b\u767c\u4eba\u54e1\u5c0d\u6b64\u90fd\u5f88\u719f\u6089\uff0c\u6b64\u7bc7\u6587\u7ae0\u662f\u81ea\u5df1\u5c0d\u65bcQuerystring\u8cc7\u8a0a\uff0c\u6574\u7406\u7d66\u65e5\u5f8c\u7684\u81ea\u5df1\u770b<\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\uff08<span style=\"text-decoration: line-through;\">\u6709\u4e9b\u4e8b\u904e30\u6b72\u5f8c\u5c31\u4e0d\u4e00\u6a23\u4e86XD<\/span>\uff09<\/span><\/p>\n<p style=\"color: #000000;\">\n<p style=\"color: #000000;\"><span style=\"color: #0000ff; font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><strong style=\"color: #336699 !important;\">\u6982\u8ff0<\/strong><\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">Querystring\uff08\u67e5\u8a62\u5b57\u4e32\uff09\u662f\u9644\u52a0\u5728\u7db2\u9801URL\u7d50\u5c3e\u7684\u8cc7\u8a0a\u3002<span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u4e3b\u8981\u662f\u5728Url\u4e0a\u50b3\u905e\u8cc7\u6599<\/span><\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u53ef\u80fd\u662f\u4e00\u500b\u641c\u5c0b\u5b57\u4e32\u3001\u9801\u78bc\u3001\u67d0\u9805\u7279\u5b9a\u7684\u6307\u6a19\u2026\u6216\u985e\u4f3c\u7684\u6771\u897f<\/span><\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u5728\u7db2\u5740\u7d50\u5c3e\u52a0\u4e0a\u4e00\u500b\u554f\u865f\uff08\uff1f\uff09\u958b\u59cb\uff0c\u6bcf\u4e00\u7d44\u53c3\u6578\u90fd\u662f\u7528\u300c\uff06\u300d\u5340\u9694\u958b\u4f86\uff0c\u662f\u4e00\u7a2eKEY \/ Value\u7684\u7d44\u5408\u3002<\/span><\/p>\n<p style=\"color: #000000;\"><a style=\"color: #004986;\" href=\"http:\/\/files.dotblogs.com.tw\/marcus116\/1207\/Querystring-_8C53\/image_16.png\"><img decoding=\"async\" loading=\"lazy\" title=\"image\" src=\"http:\/\/files.dotblogs.com.tw\/marcus116\/1207\/Querystring-_8C53\/image_thumb_6.png\" alt=\"image\" width=\"541\" height=\"240\" border=\"0\" \/><\/a><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u8209\u4f8b\u4f86\u8aaa\uff08\u53c3\u8003\u4e0a\u5716\uff09<\/span><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\uff0c\u5728Yahoo\u9996\u9801\u641c\u5c0b\u5f15\u64ce\u8f38\u5165\u300cHello world\u300d\u5f8c\uff0c\u5728\u6309\u4e0b\u641c\u5c0b\u6309\u9215<\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u6703\u5c0e\u9801\u5230\u67e5\u8a62\u7d50\u679c\u9801\u9762\uff0c\u4e26\u5c07\u7b26\u5408\u641c\u5c0b\u5b57\u4e32\u76f8\u95dc\u8cc7\u6599\u5448\u73fe\u51fa\u4f86\u3002<\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u904b\u4f5c\u539f\u7406\u662f\u900f\u904eQuerystring\u4f5c\u70ba\u8cc7\u6599\u50b3\u905e\uff0c\u7576\u4f60\u6309\u4e0b\u641c\u5c0b\u6309\u9215\u6642\uff0c\u6703\u5c07\u4f60\u5728\u9996\u9801\uff08A\u7db2\u9801\uff09\u8f38\u5165\u7684\u641c\u5c0b\u5b57\u4e32\u300cHello world\u300d\u50b3\u905e\u5230\u67e5\u8a62\u7d50\u679c\u5448\u73fe\u9801\u9762\uff08B\u7db2\u9801\uff09<\/span><\/p>\n<p style=\"color: #000000;\">\n<p style=\"color: #000000;\">\n<p style=\"color: #000000;\"><span style=\"color: #0000ff; font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><strong style=\"color: #336699 !important;\">\u4f7f\u7528\u65b9\u5f0f<\/strong><\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u53d6\u5f97Querystrnig\u53c3\u6578\u5167\u5bb9\u65b9\u5f0f\uff1a<\/span><\/p>\n<ul style=\"color: #000000;\">\n<li><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">C#\uff1a\u4f7f\u7528\u8d77\u4f86\u76f8\u7576\u65b9\u4fbf\uff0c\u53ef\u4ee5\u7528Requert.Querystring\u6216\u662fRequest.Url.Query\u53d6\u5f97\u5c0d\u61c9\u7684\u503c\uff08\u8a3b\u4e00\uff09<\/span><\/li>\n<\/ul>\n<div id=\"scid:812469c5-0cb0-4c63-8c15-c81123a09de7:b54c340f-d887-41c0-9844-c4582933c1f8\" class=\"wlWriterEditableSmartContent\" style=\"color: #000000;\">\n<div id=\"highlighter_85229\" class=\"syntaxhighlighter  \">\n<div class=\"lines\">\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>01<\/code><\/td>\n<td class=\"content\"><code class=\"comments\" style=\"color: #008200 !important;\">\/\/ \u8a2d\u5b9a<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>02<\/code><\/td>\n<td class=\"content\"><code class=\"plain\">Response.Redirect(<\/code><code class=\"string\" style=\"color: blue !important;\">\"Default.aspx?\u53c3\u6578\u540d\u7a31=\"<\/code>\u00a0<code class=\"plain\">+ \u53c3\u6578\u503c)<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>03<\/code><\/td>\n<td class=\"content\"><code class=\"plain\">Server.Transfer(<\/code><code class=\"string\" style=\"color: blue !important;\">\"Default.aspx?\u53c3\u6578\u540d\u7a31=\"<\/code>\u00a0<code class=\"plain\">+ \u53c3\u6578\u503c)<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>04<\/code><\/td>\n<td class=\"content\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>05<\/code><\/td>\n<td class=\"content\"><code class=\"comments\" style=\"color: #008200 !important;\">\/\/ \u53d6\u5f97<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>06<\/code><\/td>\n<td class=\"content\"><code class=\"comments\" style=\"color: #008200 !important;\">\/\/ \u6307\u5b9a\u7279\u5b9akey<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>07<\/code><\/td>\n<td class=\"content\"><code class=\"keyword\" style=\"font-weight: bold !important; color: #006699 !important;\">string<\/code>\u00a0<code class=\"plain\">q = Request.QueryString[<\/code><code class=\"string\" style=\"color: blue !important;\">\"\u53c3\u6578\u540d\u7a31\"<\/code><code class=\"plain\">];<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>08<\/code><\/td>\n<td class=\"content\"><code class=\"plain\">Response.Write(q);<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>09<\/code><\/td>\n<td class=\"content\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>10<\/code><\/td>\n<td class=\"content\"><code class=\"comments\" style=\"color: #008200 !important;\">\/\/ \u53d6\u5f97\u96c6\u5408<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>11<\/code><\/td>\n<td class=\"content\"><code class=\"plain\">NameValueCollection nvc = Request.QueryString;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>12<\/code><\/td>\n<td class=\"content\"><code class=\"keyword\" style=\"font-weight: bold !important; color: #006699 !important;\">foreach<\/code>\u00a0<code class=\"plain\">(<\/code><code class=\"keyword\" style=\"font-weight: bold !important; color: #006699 !important;\">string<\/code>\u00a0<code class=\"plain\">key\u00a0<\/code><code class=\"keyword\" style=\"font-weight: bold !important; color: #006699 !important;\">in<\/code>\u00a0<code class=\"plain\">nvc.Keys)<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>13<\/code><\/td>\n<td class=\"content\"><code class=\"plain\">{<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>14<\/code><\/td>\n<td class=\"content\"><code class=\"spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain\">Response.Write(<\/code><code class=\"string\" style=\"color: blue !important;\">\"{0} =&gt; {1}\"<\/code><code class=\"plain\">, key, nvc[key]);<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>15<\/code><\/td>\n<td class=\"content\"><code class=\"plain\">}<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<ul style=\"color: #000000;\">\n<li><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">Client\u7aef\uff1a\u53ef\u4ee5\u7528Javascript\u5beb\u4e00\u9577\u4e32\u5224\u65b7\u4f86\u9054\u5230\u76ee\u7684\uff0c\u5728\u6b64\u5efa\u8b70\u53ef\u4ee5\u7528jQuery\u5916\u639b\uff08<a style=\"color: #004986;\" href=\"http:\/\/archive.plugins.jquery.com\/project\/query-object\">Query String Object<\/a>\uff09\u8655\u7406\u6bd4\u8f03\u65b9\u4fbf<span style=\"text-decoration: line-through;\">\u5077\u61f6<\/span><\/span><\/li>\n<\/ul>\n<div id=\"scid:812469c5-0cb0-4c63-8c15-c81123a09de7:1854e180-c596-40b2-a9e2-1603d8de11f2\" class=\"wlWriterEditableSmartContent\" style=\"color: #000000;\">\n<div id=\"highlighter_237577\" class=\"syntaxhighlighter  \">\n<div class=\"lines\">\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>1<\/code><\/td>\n<td class=\"content\"><code class=\"comments\" style=\"color: #008200 !important;\">\/*\u4f7f\u7528jQuery\u5916\u639b\uff1ajQuery String Object*\/<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>2<\/code><\/td>\n<td class=\"content\"><code class=\"comments\" style=\"color: #008200 !important;\">\/\/ \u8a2d\u5b9a<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>3<\/code><\/td>\n<td class=\"content\"><code class=\"keyword\" style=\"font-weight: bold !important; color: #006699 !important;\">var<\/code>\u00a0<code class=\"plain\">newUrl = $.query.set(<\/code><code class=\"string\" style=\"color: blue !important;\">\"\u53c3\u6578\u540d\u7a31\"<\/code><code class=\"plain\">, \u53c3\u6578\u503c).toString();\u00a0\u00a0\u00a0\u00a0<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>4<\/code><\/td>\n<td class=\"content\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>5<\/code><\/td>\n<td class=\"content\"><code class=\"comments\" style=\"color: #008200 !important;\">\/\/ \u53d6\u5f97<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>6<\/code><\/td>\n<td class=\"content\"><code class=\"keyword\" style=\"font-weight: bold !important; color: #006699 !important;\">var<\/code>\u00a0<code class=\"plain\">str = $.query.get(<\/code><code class=\"string\" style=\"color: blue !important;\">'\u53c3\u6578\u540d\u7a31'<\/code><code class=\"plain\">);<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u8a3b\u4e00\uff1a\u4f7f\u7528Request.QueryString\u6703\u6539\u8b8a\u7de8\u78bc\uff0c\u70ba\u78ba\u4fdd\u63a5\u6536\u53c3\u6578\u4e0d\u53d7\u5f71\u97ff\uff0c\u53ef\u4ee5\u4f7f\u7528Request.Url.Query\u53d6\u5f97\u5c1a\u672a\u89e3\u78bc\u7684\u539f\u59cb\u5b57\u4e32\uff0c\u5728\u9032\u884c\u89e3\u78bc\u3002<\/span><\/p>\n<p style=\"color: #000000;\">\n<p style=\"color: #000000;\">\n<p style=\"color: #000000;\"><span style=\"color: #0000ff; font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><strong style=\"color: #336699 !important;\">URL\u7de8\u78bc<\/strong><\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u5728URL\u7db2\u8def\u6a19\u6e96\u898f\u7bc4\u4e2d\u6709\u898f\u5b9a\uff0cURL\u7db2\u5740\u53ea\u80fd\u7528\u82f1\u6587\u5b57\u6bcd\u548c\u6578\u5b57[0-9a-zA-Z]\u3001\u4e00\u4e9b\u7279\u6b8a\u7b26\u865f\u53ca\u7279\u5b9a\u4fdd\u7559\u5b57\uff0c\u624d\u53ef\u4ee5\u4e0d\u7d93\u904e\u7de8\u78bc\u76f4\u63a5\u7528\u5728URL\uff08\u8a3b\u4e8c\uff09<\/span><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\">\uff0c<\/span>\u9019\u610f\u8b02URL\u4e2d\u5982\u679c\u6709\u4e2d\u6587\u5b57\u7684\u8a71\uff0c\u5c31\u5fc5\u9808\u7d93\u904e\u7de8\u78bc\u5f8c\u4f7f\u7528\u3002\uff08\u8a3b\u4e09\uff09<\/p>\n<p style=\"color: #000000;\">\u5728\u7a0b\u5f0f\u958b\u767c\u6642\uff0c\u700f\u89bd\u5668\u5982\u679c\u8981\u5728Querystring\u4e2d\u5e36\u6709\u4e2d\u6587\u5b57\u6216\u662f\u7279\u6b8a\u5b57\u5143\u8cc7\u6599\u6642\uff0c\u53ef\u4ee5\u900f\u904e\u4ee5\u4e0b\u9032\u884c\u7de8\u78bc\uff06\u89e3\u78bc<\/p>\n<ul style=\"color: #000000;\">\n<li><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">.Net Framework\uff1a<\/span><\/li>\n<\/ul>\n<div id=\"scid:812469c5-0cb0-4c63-8c15-c81123a09de7:52bf5981-abe3-4a0f-ae3b-b1ff79ecbb30\" class=\"wlWriterEditableSmartContent\" style=\"color: #000000;\">\n<div id=\"highlighter_32321\" class=\"syntaxhighlighter  \">\n<div class=\"lines\">\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>1<\/code><\/td>\n<td class=\"content\"><code class=\"comments\" style=\"color: #008200 !important;\">\/\/ \u4f7f\u7528Server.UrlEncode\u9032\u884c\u7de8\u78bc<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>2<\/code><\/td>\n<td class=\"content\"><code class=\"plain\">String myURL =\u00a0<\/code><code class=\"string\" style=\"color: blue !important;\">\"<a style=\"color: #004986;\" href=\"http:\/\/www.abc.com\/Search.aspx?q=\">http:\/\/www.ABC.com\/Search.aspx?q=<\/a>\"<\/code>\u00a0<code class=\"plain\">+ Server.UrlEncode(<\/code><code class=\"string\" style=\"color: blue !important;\">\"\u4f60\u597d\u55ce\"<\/code><code class=\"plain\">);<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>3<\/code><\/td>\n<td class=\"content\"><code class=\"plain\">Response.Write(<\/code><code class=\"string\" style=\"color: blue !important;\">\"&lt;a href=\"<\/code>\u00a0<code class=\"plain\">+ myURL +\u00a0<\/code><code class=\"string\" style=\"color: blue !important;\">\"&gt; \u4f60\u597d\u55ce &lt;\/a&gt;\"<\/code><code class=\"plain\">);<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>4<\/code><\/td>\n<td class=\"content\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>5<\/code><\/td>\n<td class=\"content\"><code class=\"comments\" style=\"color: #008200 !important;\">\/\/ \u4f7f\u7528Server.UrlDecode\u9032\u884c\u89e3\u78bc<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>6<\/code><\/td>\n<td class=\"content\"><code class=\"plain\">String myDecodedString = Server.UrlDecode(URI);<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>7<\/code><\/td>\n<td class=\"content\"><code class=\"plain\">Response.Write(<\/code><code class=\"string\" style=\"color: blue !important;\">\"Decoded\uff1a\"<\/code>\u00a0<code class=\"plain\">+ myDecodedString );<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<ul style=\"color: #000000;\">\n<li><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">Javascript\uff1a<\/span><\/li>\n<\/ul>\n<div id=\"scid:812469c5-0cb0-4c63-8c15-c81123a09de7:68d1678a-5b95-4031-b68c-b8f7503c7d86\" class=\"wlWriterEditableSmartContent\" style=\"color: #000000;\">\n<div id=\"highlighter_615169\" class=\"syntaxhighlighter  \">\n<div class=\"lines\">\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>1<\/code><\/td>\n<td class=\"content\"><code class=\"comments\" style=\"color: #008200 !important;\">\/\/ URL\u7de8\u78bc\uff1aencodeURI()\uff1a\u4ee5UTF-8\u8f38\u51fa\uff0c\u5728\u6bcf\u500b\u5b57\u524d\u9762\u52a0\u4e0a%<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>2<\/code><\/td>\n<td class=\"content\"><code class=\"plain\">url = url +\u00a0<\/code><code class=\"string\" style=\"color: blue !important;\">\"?q=\"<\/code>\u00a0<code class=\"plain\">+ encodeURI(<\/code><code class=\"string\" style=\"color: blue !important;\">\"\u4f60\u597d\u55ce\"<\/code><code class=\"plain\">);<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>3<\/code><\/td>\n<td class=\"content\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt2\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>4<\/code><\/td>\n<td class=\"content\"><code class=\"comments\" style=\"color: #008200 !important;\">\/\/ URL\u89e3\u78bc\uff1adecodeURI()<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"line alt1\">\n<table>\n<tbody>\n<tr>\n<td class=\"number\" style=\"color: #afafaf !important;\"><code>5<\/code><\/td>\n<td class=\"content\"><code class=\"plain\">document.write(encodeURI(URI)<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u5728\u7db2\u8def\u898f\u7bc4\u4e2d\u6c92\u6709\u898f\u5b9a\u5177\u9ad4\u7684\u7de8\u78bc\u65b9\u6cd5\uff0c\u700f\u89bd\u5668\u672c\u8eab\u53ef\u4ee5\u81ea\u884c\u8a2d\u5b9a\uff0c\u5c0e\u81f4URL\u7de8\u78bc\u6709\u9ede\u6df7\u4e82\uff0c\u958b\u767c\u4e0a\u5fc5\u9808\u8981\u66f4\u52a0\u5c0f\u5fc3<\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u6709\u95dcURL\u7de8\u78bc\u7684\u7d30\u7bc0\uff0c\u6211\u63a8\u85a6\u5927\u5bb6\u53ef\u4ee5\u53c3\u8003\u300c<a style=\"color: #004986;\" href=\"http:\/\/www.ruanyifeng.com\/blog\/2010\/02\/url_encoding.html\">\u5173\u4e8eURL\u7f16\u7801<\/a>\u300d\uff0c\u9019\u7bc7\u6587\u7ae0\u4e2d\u6709\u8a73\u7d30\u7684\u4ecb\u7d39\uff08\u6211\u770b\u5b8c\u624d\u6bd4\u8f03\u77ad\u89e3\uff0c\u906e\u81c9 XD\uff09<\/span><\/p>\n<p style=\"color: #000000;\">\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u8a3b\u4e8c\uff1a<a style=\"color: #004986;\" href=\"http:\/\/www.ietf.org\/rfc\/rfc1738.txt\">RFC 1783<\/a>\uff1a&#8221;&#8230;Only alphanumerics [0-9a-zA-Z], the special characters &#8220;$-_.+!*'(),&#8221; [not including the quotes &#8211; ed], and reserved characters used for their reserved purposes may be used unencoded within a URL.&#8221;<\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u8a3b\u4e09\uff1a\u5728google\u8f38\u5165\u300c\u4f60\u597d\u55ce\u300d\u4e09\u500b\u5b57\u6642\uff0c\u6309\u4e0b\u641c\u5c0b\u4e4b\u5f8c\uff0c\u641c\u5c0b\u7d50\u679c\u9801\u9762\u7db2\u5740\u5448\u73fe\u7684\u67e5\u8a62\u5b57\u4e32\u6703\u662fUTF-8\u7de8\u78bc\u5f8c\u300c%E4%BD%A0%E5%A5%BD%E5%97%8E\u300d<\/span><\/p>\n<p style=\"color: #000000;\">\n<p style=\"color: #000000;\">\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><span style=\"color: #0000ff; font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><strong style=\"color: #336699 !important;\">\u5b89\u5168\u6027<\/strong><\/span><\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">Querystring\u5728\u4f7f\u7528\u4e0a\u5f88\u65b9\u4fbf\uff0c\u4f46\u4ee5\u5b89\u5168\u6027\u8003\u91cf\u4f86\u8aaa\uff0c\u662f\u6709\u6dfa\u5728\u5b89\u5168\u6027\u98a8\u96aa\u6ef4<\/span><\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u56e0\u70ba\u53ef\u900f\u904e\u700f\u89bd\u5668\u770b\u5230\u7db2\u5740\u5167\u5bb9\uff0c\u6e05\u695a\u53ef\u898b\u67e5\u8a62\u7684\u8cc7\u8a0a\uff0c\u4e14\u4f7f\u7528\u8005\u53ef\u4efb\u610f\u4fee\u6539<\/span><\/span><\/p>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u4f7f\u7528\u6642\u6709\u5e7e\u9ede\u5efa\u8b70<span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\uff08\u7db2\u8def\u662f\u5f88\u5371\u96aa\u6ef4\uff0c\u5927\u4eba\u5011\u8acb\u591a\u591a\u7559\u610f\u963f\uff09<\/span><\/span><\/span><\/span><\/span><\/p>\n<ul style=\"color: #000000;\">\n<li><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u9a57\u8b49\u8cc7\u6599\uff1a\u4e0d\u8981\u8f15\u6613\u76f8\u4fe1\u5f9eClient\u50b3\u4f86\u7684URL\u7db2\u5740\uff0c<\/span><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u5c0d\u65bc<span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">Querystring\u7684\u53c3\u6578\u503c\u662f\u8981\u7d93\u904e\u9a57\u8b49\u3002\u6709\u5fc3\u7684\u99ed\u5ba2\u8981\u7aca\u53d6\u7db2\u7ad9\u8cc7\u6599\uff0c\u6703\u5c07\u653b\u64ca\u6307\u4ee4\u7d44\u6210\u4e00\u9577\u5b57\u4e32Querystring\uff0c\u9032\u884cSQL Inject\u653b\u64ca\uff08\u8a3b\u56db\uff09<\/span><\/span><\/span><\/li>\n<li><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u654f\u611f\u6027\u8cc7\u6599\uff1a\u56e0\u70ba\u6dfa\u800c\u6613\u898b\uff0c\u4e0d\u8981\u653e\u7f6e\u654f\u611f\u6027\u8cc7\u6599\u5728<span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">Querystring<\/span><\/span><\/span><\/span><\/li>\n<li><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u9577\u5ea6\u9650\u5236\uff1a<\/span><\/span><\/span><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u4e00\u4e9b\u700f\u89bd\u5668\u5c0d\u65bcQuerystring\u6709\u9577\u5ea6\u9650\u5236\uff0c\u8d85\u904e\u9810\u8a2d\u9577\u5ea6\u5b57\u5143\u6642\uff0cQuerystring\u6703\u88ab\u622a\u65b7\uff0c\u8a73\u7d30\u53ef\u4ee5\u53c3\u8003<a style=\"color: #004986;\" href=\"http:\/\/www.dotblogs.com.tw\/jimmyyu\/archive\/2010\/03\/25\/asp-net-40-max-query-string-length.aspx\">ASP.NET 4.0 \u8a2d\u5b9aQueryString\u7684\u6700\u5927\u9577\u5ea6<\/a><\/span><\/span><\/li>\n<\/ul>\n<p style=\"color: #000000;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4;\"><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u8a3b\u56db\uff1aSQL Inject\u53ef\u4ee5\u53c3\u8003\u9ed1\u6697\u5927\u6587\u7ae0\u5beb\u7684<\/span><span style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: x-large;\">\u300c<a style=\"color: #004986;\" href=\"http:\/\/blog.darkthread.net\/post-2008-05-22-hit-and-run-sql-injection-attack.aspx\">\u6e38\u64ca\u5f0f\u7684SQL Injection\u653b\u64ca<\/a>\u300d<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f86\u6e90 http:\/\/www.dotblogs.com.tw\/marcus116\/archive\/2012\/07 &hellip; <a href=\"https:\/\/www.kuki.idv.tw\/?p=2505\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008[\u8f49][.NET] QueryString \u7684\u90a3\u4e9b\u4e8b\u3009<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2505"}],"collection":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2505"}],"version-history":[{"count":1,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2505\/revisions"}],"predecessor-version":[{"id":2506,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2505\/revisions\/2506"}],"wp:attachment":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}