{"id":59409,"date":"2024-10-12T21:49:18","date_gmt":"2024-10-12T13:49:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/59409\/"},"modified":"2024-10-12T21:49:18","modified_gmt":"2024-10-12T13:49:18","slug":"asp%e5%af%a6%e7%8f%bepost%e6%96%b9%e5%bc%8f%e6%aa%a2%e6%b8%ac%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e6%96%b9%e6%b3%95%e8%a9%b3%e8%a7%a3-asp%e6%aa%a2%e6%b8%ac%e6%95%b8%e6%93%9a%e5%ba%abpost","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/59409\/","title":{"rendered":"ASP\u5be6\u73fePOST\u65b9\u5f0f\u6aa2\u6e2c\u6578\u64da\u5eab\u7684\u65b9\u6cd5\u8a73\u89e3 (asp\u6aa2\u6e2c\u6578\u64da\u5eabpost)"},"content":{"rendered":"<h1 id=\"asp%e5%af%a6%e7%8f%bepost%e6%96%b9%e5%bc%8f%e6%aa%a2%e6%b8%ac%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e6%96%b9%e6%b3%95%e8%a9%b3%e8%a7%a3-zxIHmtGNMU\">ASP\u5be6\u73fePOST\u65b9\u5f0f\u6aa2\u6e2c\u6578\u64da\u5eab\u7684\u65b9\u6cd5\u8a73\u89e3<\/h1>\n<p>\u5728\u7db2\u9801\u958b\u767c\u4e2d\uff0cASP\uff08Active Server Pages\uff09\u662f\u4e00\u7a2e\u5e38\u7528\u7684\u4f3a\u670d\u5668\u7aef\u8173\u672c\u6280\u8853\uff0c\u80fd\u5920\u52d5\u614b\u751f\u6210\u7db2\u9801\u5167\u5bb9\u3002\u7576\u9700\u8981\u5f9e\u7528\u6236\u7aef\u63d0\u4ea4\u6578\u64da\u5230\u4f3a\u670d\u5668\u6642\uff0cPOST\u65b9\u6cd5\u662f\u4e00\u7a2e\u5e38\u898b\u7684\u9078\u64c7\u3002\u672c\u6587\u5c07\u8a73\u7d30\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528ASP\u5be6\u73fePOST\u65b9\u5f0f\u6aa2\u6e2c\u6578\u64da\u5eab\u7684\u65b9\u6cd5\uff0c\u4e26\u63d0\u4f9b\u76f8\u95dc\u7684\u7bc4\u4f8b\u4ee3\u78bc\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%afpost%e6%96%b9%e6%b3%95%ef%bc%9f-zxIHmtGNMU\">\u4ec0\u9ebc\u662fPOST\u65b9\u6cd5\uff1f<\/h2>\n<p>POST\u65b9\u6cd5\u662fHTTP\u5354\u8b70\u4e2d\u7684\u4e00\u7a2e\u8acb\u6c42\u65b9\u5f0f\uff0c\u4e3b\u8981\u7528\u65bc\u5411\u4f3a\u670d\u5668\u63d0\u4ea4\u6578\u64da\u3002\u8207GET\u65b9\u6cd5\u4e0d\u540c\uff0cPOST\u65b9\u6cd5\u4e0d\u6703\u5c07\u6578\u64da\u986f\u793a\u5728URL\u4e2d\uff0c\u9019\u4f7f\u5f97\u5b83\u66f4\u9069\u5408\u8655\u7406\u654f\u611f\u4fe1\u606f\u6216\u5927\u91cf\u6578\u64da\u3002<\/p>\n<h2 id=\"asp%e4%b8%ad%e4%bd%bf%e7%94%a8post%e6%96%b9%e6%b3%95%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%ad%a5%e9%a9%9f-zxIHmtGNMU\">ASP\u4e2d\u4f7f\u7528POST\u65b9\u6cd5\u7684\u57fa\u672c\u6b65\u9a5f<\/h2>\n<p>\u5728ASP\u4e2d\u4f7f\u7528POST\u65b9\u6cd5\u6aa2\u6e2c\u6578\u64da\u5eab\u7684\u57fa\u672c\u6b65\u9a5f\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\u5275\u5efaHTML\u8868\u55ae\uff0c\u4f7f\u7528POST\u65b9\u6cd5\u63d0\u4ea4\u6578\u64da\u3002<\/li>\n<li>\u5728ASP\u9801\u9762\u4e2d\u63a5\u6536POST\u6578\u64da\u3002<\/li>\n<li>\u9023\u63a5\u6578\u64da\u5eab\uff0c\u57f7\u884c\u67e5\u8a62\u3002<\/li>\n<li>\u8655\u7406\u67e5\u8a62\u7d50\u679c\uff0c\u4e26\u8fd4\u56de\u76f8\u61c9\u7684\u97ff\u61c9\u3002<\/li>\n<\/ol>\n<h2 id=\"%e7%af%84%e4%be%8b%e4%bb%a3%e7%a2%bc-zxIHmtGNMU\">\u7bc4\u4f8b\u4ee3\u78bc<\/h2>\n<h3 id=\"1-%e5%89%b5%e5%bb%bahtml%e8%a1%a8%e5%96%ae-zxIHmtGNMU\">1. \u5275\u5efaHTML\u8868\u55ae<\/h3>\n<pre><code>&lt;form action=\"process.asp\" method=\"post\"&gt;\n    &lt;label for=\"username\"&gt;\u7528\u6236\u540d:&lt;\/label&gt;\n    &lt;input type=\"text\" id=\"username\" name=\"username\"&gt;\n    &lt;br&gt;\n    &lt;label for=\"password\"&gt;\u5bc6\u78bc:&lt;\/label&gt;\n    &lt;input type=\"password\" id=\"password\" name=\"password\"&gt;\n    &lt;br&gt;\n    &lt;input type=\"submit\" value=\"\u63d0\u4ea4\"&gt;\n&lt;\/form&gt;<\/code><\/pre>\n<h3 id=\"2-%e5%9c%a8asp%e9%a0%81%e9%9d%a2%e4%b8%ad%e6%8e%a5%e6%94%b6post%e6%95%b8%e6%93%9a-zxIHmtGNMU\">2. \u5728ASP\u9801\u9762\u4e2d\u63a5\u6536POST\u6578\u64da<\/h3>\n<pre><code>&lt;% \n    Dim username, password\n    username = Request.Form(\"username\")\n    password = Request.Form(\"password\")\n%&gt;<\/code><\/pre>\n<h3 id=\"3-%e9%80%a3%e6%8e%a5%e6%95%b8%e6%93%9a%e5%ba%ab-zxIHmtGNMU\">3. \u9023\u63a5\u6578\u64da\u5eab<\/h3>\n<p>\u5728\u9019\u4e00\u6b65\u4e2d\uff0c\u6211\u5011\u9700\u8981\u4f7f\u7528ADODB.Connection\u5c0d\u8c61\u4f86\u9023\u63a5\u6578\u64da\u5eab\u3002\u4ee5\u4e0b\u662f\u9023\u63a5\u6578\u64da\u5eab\u7684\u7bc4\u4f8b\u4ee3\u78bc\uff1a<\/p>\n<pre><code>&lt;%\n    Dim conn, rs, sql\n    Set conn = Server.CreateObject(\"ADODB.Connection\")\n    conn.Open \"Provider=SQLOLEDB;Data Source=\u4f60\u7684\u6578\u64da\u5eab\u5730\u5740;Initial Catalog=\u4f60\u7684\u6578\u64da\u5eab\u540d\u7a31;User ID=\u4f60\u7684\u7528\u6236\u540d;Password=\u4f60\u7684\u5bc6\u78bc;\"\n%&gt;<\/code><\/pre>\n<h3 id=\"4-%e5%9f%b7%e8%a1%8c%e6%9f%a5%e8%a9%a2-zxIHmtGNMU\">4. \u57f7\u884c\u67e5\u8a62<\/h3>\n<p>\u63a5\u4e0b\u4f86\uff0c\u6211\u5011\u5c07\u57f7\u884cSQL\u67e5\u8a62\u4f86\u6aa2\u6e2c\u7528\u6236\u540d\u548c\u5bc6\u78bc\u662f\u5426\u6b63\u78ba\uff1a<\/p>\n<pre><code>&lt;%\n    sql = \"SELECT * FROM Users WHERE username='\" &amp; username &amp; \"' AND password='\" &amp; password &amp; \"'\"\n    Set rs = conn.Execute(sql)\n\n    If Not rs.EOF Then\n        Response.Write(\"\u767b\u9304\u6210\u529f\uff01\")\n    Else\n        Response.Write(\"\u7528\u6236\u540d\u6216\u5bc6\u78bc\u932f\u8aa4\u3002\")\n    End If\n\n    rs.Close\n    conn.Close\n%&gt;<\/code><\/pre>\n<h2 id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-zxIHmtGNMU\">\u6ce8\u610f\u4e8b\u9805<\/h2>\n<ul>\n<li>\u5728\u8655\u7406\u7528\u6236\u8f38\u5165\u6642\uff0c\u52d9\u5fc5\u9032\u884c\u9069\u7576\u7684\u6578\u64da\u9a57\u8b49\u548c\u6e05\u7406\uff0c\u4ee5\u9632\u6b62SQL\u6ce8\u5165\u653b\u64ca\u3002<\/li>\n<li>\u8003\u616e\u4f7f\u7528\u52a0\u5bc6\u6280\u8853\u4f86\u5b58\u5132\u5bc6\u78bc\uff0c\u78ba\u4fdd\u7528\u6236\u6578\u64da\u7684\u5b89\u5168\u6027\u3002<\/li>\n<li>\u5728\u751f\u7522\u74b0\u5883\u4e2d\uff0c\u61c9\u4f7f\u7528\u66f4\u5b89\u5168\u7684\u9023\u63a5\u5b57\u7b26\u4e32\u548c\u6578\u64da\u5eab\u914d\u7f6e\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-zxIHmtGNMU\">\u7e3d\u7d50<\/h2>\n<p>\u672c\u6587\u4ecb\u7d39\u4e86\u5982\u4f55\u4f7f\u7528ASP\u5be6\u73fePOST\u65b9\u5f0f\u6aa2\u6e2c\u6578\u64da\u5eab\u7684\u65b9\u6cd5\uff0c\u5f9e\u5275\u5efaHTML\u8868\u55ae\u5230\u57f7\u884c\u67e5\u8a62\u7684\u6bcf\u4e00\u6b65\u90fd\u63d0\u4f9b\u4e86\u8a73\u7d30\u7684\u7bc4\u4f8b\u4ee3\u78bc\u3002\u900f\u904e\u9019\u4e9b\u6b65\u9a5f\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u8f15\u9b06\u5730\u8655\u7406\u7528\u6236\u63d0\u4ea4\u7684\u6578\u64da\u4e26\u9032\u884c\u6578\u64da\u5eab\u67e5\u8a62\u3002\u82e5\u60a8\u9700\u8981\u7a69\u5b9a\u7684\u4f3a\u670d\u5668\u74b0\u5883\u4f86\u904b\u884c\u60a8\u7684ASP\u61c9\u7528\uff0c\u8003\u616e\u4f7f\u7528\u6211\u5011\u7684<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u89e3\u6c7a\u65b9\u6848\uff0c\u63d0\u4f9b\u9ad8\u6548\u80fd\u548c\u5b89\u5168\u7684\u670d\u52d9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6df1\u5165\u63a2\u8a0eASP\u5be6\u73fePOST\u65b9\u5f0f\u6aa2\u6e2c\u6578\u64da\u5eab\u7684\u65b9\u6cd5\uff0c\u63d0\u4f9b\u8a73\u7d30\u6b65\u9a5f\u8207\u7bc4\u4f8b\uff0c\u52a9\u60a8\u8f15\u9b06\u638c\u63e1\u6578\u64da\u5eab\u64cd\u4f5c\u6280\u5de7\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-59409","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/59409","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=59409"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/59409\/revisions"}],"predecessor-version":[{"id":59410,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/59409\/revisions\/59410"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=59409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=59409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=59409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}