{"id":2516,"date":"2014-07-11T13:32:19","date_gmt":"2014-07-11T05:32:19","guid":{"rendered":"http:\/\/kuki.idv.tw\/?p=2516"},"modified":"2014-07-11T13:32:19","modified_gmt":"2014-07-11T05:32:19","slug":"asp-net%e9%a0%81%e9%9d%a2%e9%96%93%e7%9a%84%e5%82%b3%e5%80%bc%e7%9a%84%e5%b9%be%e7%a8%ae%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.kuki.idv.tw\/?p=2516","title":{"rendered":"ASP.NET\u9801\u9762\u9593\u7684\u50b3\u503c\u7684\u5e7e\u7a2e\u65b9\u6cd5"},"content":{"rendered":"<p><span style=\"color: #ff6600;\">\u00a0ASP.NET\u9801\u9762\u9593\u7684\u50b3\u503c\u7684\u5e7e\u7a2e\u65b9\u6cd5<\/span><span style=\"color: #666666;\">\u00a0<\/span><br style=\"color: #666666;\" \/><span style=\"color: #666666;\">\u00a0ASP.NET WEB FORMS \u7d66\u958b\u767c\u8005\u63d0\u4f9b\u4e86\u6975\u597d\u7684\u4e8b\u4ef6\u9a45\u52d5\u958b\u767c\u6a21\u5f0f\u3002\u7136\u800c\u9019\u7a2e\u7c21\u55ae\u7684\u61c9\u7528\u7a0b\u5e8f\u958b\u767c\u6a21\u5f0f\u537b\u7d66\u6211\u5011\u5e36\u4f86\u4e86\u4e00\u4e9b\u5c0f\u554f\u984c\uff0c\u8209\u500b\u4f8b\u5b50\uff0c\u5728\u50b3\u7d71\u7684ASP\u61c9\u7528\u7a0b\u5e8f\u4e2d\uff0c\u4f60\u80fd\u5920\u901a\u904ePOST\u65b9\u6cd5\u5f88\u5bb9\u6613\u7684\u628a\u4e00\u500b\u503c\u6216\u591a\u500b\u503c\u5f9e\u4e00\u500b\u9801\u9762\u50b3\u9001\u5230\u53e6\u4e00\u500b\u9801\u9762\uff0c\u7528\u540c\u6a23\u7684\u65b9\u6cd5\u5728ASP.NET\u4e2d\u5be6\u73fe\u6709\u9ede\u9ebb\u7169\u3002\u5728\u9019\u88e1\uff0c\u6211\u5011\u53ef\u4ee5\u901a\u904e\u5176\u4ed6\u65b9\u5f0f\u4f86\u89e3\u6c7a\u9019\u7a2e\u60c5\u5f62\u3002ASP.NET\u70ba\u6211\u5011\u63d0\u4f9b\u4e86\u4e09\u7a2e\u65b9\u5f0f\uff0c\u4e00\u7a2e\u662f\u53ef\u4ee5\u901a\u904e\u7528QueryString\u4f86\u50b3\u9001\u76f8\u61c9\u7684\u503c\uff0c\u518d\u4e00\u7a2e\u662f\u901a\u904esession\u8b8a\u91cf\u4f86\u50b3\u9001\u76f8\u61c9\u7684\u503c\uff0c\u9084\u6709\u5c31\u662f\u901a\u904eServer.Transfer\u65b9\u6cd5\u4f86\u5be6\u73fe\u3002\u4e0b\u9762\u5206\u5225\u4e00\u4e00\u4ecb\u7d39\uff1a\u00a0<\/span><\/p>\n<div style=\"color: #666666;\"><\/div>\n<div style=\"color: #666666;\">\u4e00\u3001\u4f7f\u7528Querystring<\/div>\n<div style=\"color: #666666;\">Querystring\u662f\u4e00\u7a2e\u975e\u5e38\u7c21\u55ae\u7684\u50b3\u503c\u65b9\u5f0f\uff0c\u5176\u7f3a\u9ede\u5c31\u662f\u6703\u628a\u8981\u50b3\u9001\u7684\u503c\u986f\u793a\u5728\u700f\u89bd\u5668\u7684\u5730\u5740\u6b04\u4e2d\uff0c\u4e26\u4e14\u5728\u6b64\u65b9\u6cd5\u4e2d\u4e0d\u80fd\u5920\u50b3\u905e\u5c0d\u8c61\u3002\u5982\u679c\u4f60\u60f3\u50b3\u905e\u4e00\u500b\u5b89\u5168\u6027\u4e0d\u662f\u90a3\u9ebc\u592a\u91cd\u8981\u6216\u8005\u662f\u4e00\u500b\u7c21\u55ae\u7684\u6578\u503c\u6642\uff0c\u7528\u6b64\u65b9\u6cd5\u6700\u597d\u4e0d\u904e\u4e86\u3002\u4e0b\u9762\u901a\u904e\u4e00\u500b\u5c0f\u4f8b\u5b50\u4f86\u5b8c\u6210\u50b3\u503c\u5de5\u4f5c\uff0c\u6b65\u9a5f\u5982\u4e0b\uff1a<\/div>\n<div style=\"color: #666666;\">1\u3001\u5275\u5efa\u4e00\u500bweb form<\/div>\n<div style=\"color: #666666;\">2\u3001\u5728\u65b0\u5efa\u7684web form\u4e2d\u653e\u7f6e\u4e00\u500bbutton1\uff0c\u5728\u653e\u7f6e\u5169\u500bTextBox1,TextBox2<\/div>\n<div style=\"color: #666666;\">3\u3001\u70babutton\u6309\u9215\u5275\u5efaclick\u4e8b\u4ef6<\/div>\n<div style=\"color: #666666;\">\u4ee3\u78bc\u5982\u4e0b\uff1a<\/div>\n<div style=\"color: #666666;\">private void Button1_Click<\/div>\n<div style=\"color: #666666;\">(object sender, System.EventArgs e)<\/div>\n<div style=\"color: #666666;\">{<\/div>\n<div style=\"color: #666666;\">string url;<\/div>\n<div style=\"color: #666666;\">url=&#8221;webform2.aspx?name=&#8221; +<\/div>\n<div style=\"color: #666666;\">TextBox1.Text + &#8220;&amp;email=&#8221; +<\/div>\n<div style=\"color: #666666;\">TextBox2.Text;<\/div>\n<div style=\"color: #666666;\">Response.Redirect(url);<\/div>\n<div style=\"color: #666666;\">}<\/div>\n<div style=\"color: #666666;\">4\u3001\u65b0\u5efa\u4e00\u500b\u76ee\u6a19\u9801\u9762\u547d\u540d\u70bawebform2<\/div>\n<div style=\"color: #666666;\">5\u3001\u5728webform2\u4e2d\u653e\u7f6e\u5169\u500bLabel1,Label2<\/div>\n<div style=\"color: #666666;\">\u5728webform2\u7684Page_Load\u4e2d\u6dfb\u52a0\u5982\u4e0b\u4ee3\u78bc\uff1a<\/div>\n<div style=\"color: #666666;\">private void Page_Load<\/div>\n<div style=\"color: #666666;\">(object sender, System.EventArgs e)<\/div>\n<div style=\"color: #666666;\">{<\/div>\n<div style=\"color: #666666;\">Label1.Text=Request.QueryString[&#8220;name&#8221;];<\/div>\n<div style=\"color: #666666;\">Label2.Text=Request.QueryString[&#8220;email&#8221;];<\/div>\n<div style=\"color: #666666;\">}<\/div>\n<div style=\"color: #666666;\">\u904b\u884c,\u5373\u53ef\u770b\u5230\u50b3\u905e\u5f8c\u7684\u7d50\u679c\u4e86\u3002<\/div>\n<div style=\"color: #666666;\"><\/div>\n<div style=\"color: #666666;\">\u4e8c\u3001\u4f7f\u7528Session\u8b8a\u91cf<\/div>\n<div style=\"color: #666666;\"><\/div>\n<div style=\"color: #666666;\">\u4f7f\u7528Session\u8b8a\u91cf\u50b3\u503c\u662f\u4e00\u7a2e\u6700\u5e38\u898b\u7684\u65b9\u5f0f\u4e86\uff0c\u6b64\u4e2d\u65b9\u5f0f\u4e0d\u50c5\u53ef\u4ee5\u628a\u503c\u50b3\u905e\u5230\u4e0b\u4e00\u500b\u9801\u9762\uff0c\u9084\u53ef\u4ee5\u4ea4\u53c9\u50b3\u905e\u5230\u591a\u500b\u9801\u9762\uff0c\u76f4\u81f3\u628aSession\u8b8a\u91cf\u7684\u503cremoved\u5f8c\uff0c\u8b8a\u91cf\u624d\u6703\u6d88\u5931\u3002\u8209\u500b\u4f8b\u5b50\u770b\u770b\uff1a<\/div>\n<div style=\"color: #666666;\">1\u3001\u5275\u5efa\u4e00\u500bweb form<\/div>\n<div style=\"color: #666666;\">2\u3001\u5728\u65b0\u5efa\u7684web form\u4e2d\u653e\u7f6e\u4e00\u500bbutton1\uff0c\u5728\u653e\u7f6e\u5169\u500bTextBox1,TextBox2<\/div>\n<div style=\"color: #666666;\">3\u3001\u70babutton\u6309\u9215\u5275\u5efaclick\u4e8b\u4ef6<\/div>\n<div style=\"color: #666666;\">\u4ee3\u78bc\u5982\u4e0b\uff1a<\/div>\n<div style=\"color: #666666;\">private void Button1_Click<\/div>\n<div style=\"color: #666666;\">(object sender, System.EventArgs e)<\/div>\n<div style=\"color: #666666;\">{<\/div>\n<div style=\"color: #666666;\">Session[&#8220;name&#8221;]=TextBox1.Text;<\/div>\n<div style=\"color: #666666;\">Session[&#8220;email&#8221;]=TextBox2.Text;<\/div>\n<div style=\"color: #666666;\">Response.Redirect(&#8220;webform2.aspx&#8221;);<\/div>\n<div style=\"color: #666666;\">}<\/div>\n<div style=\"color: #666666;\">4\u3001\u65b0\u5efa\u4e00\u500b\u76ee\u6a19\u9801\u9762\u547d\u540d\u70bawebform2<\/div>\n<div style=\"color: #666666;\">5\u3001\u5728webform2\u4e2d\u653e\u7f6e\u5169\u500bLabel1,Label2<\/div>\n<div style=\"color: #666666;\">\u5728webform2\u7684Page_Load\u4e2d\u6dfb\u52a0\u5982\u4e0b\u4ee3\u78bc\uff1a<\/div>\n<div style=\"color: #666666;\">private void Page_Load<\/div>\n<div style=\"color: #666666;\">(object sender, System.EventArgs e)<\/div>\n<div style=\"color: #666666;\">{<\/div>\n<div style=\"color: #666666;\">Label1.Text=Session[&#8220;name&#8221;].ToString();<\/div>\n<div style=\"color: #666666;\">Label2.Text=Session[&#8220;email&#8221;].ToString();<\/div>\n<div style=\"color: #666666;\">Session.Remove(&#8220;name&#8221;);<\/div>\n<div style=\"color: #666666;\">Session.Remove(&#8220;email&#8221;);<\/div>\n<div style=\"color: #666666;\">}<\/div>\n<div style=\"color: #666666;\">\u904b\u884c,\u5373\u53ef\u770b\u5230\u50b3\u905e\u5f8c\u7684\u7d50\u679c\u4e86\u3002<\/div>\n<div style=\"color: #666666;\"><\/div>\n<div style=\"color: #666666;\">\u4e09\u3001\u4f7f\u7528Server.Transfer<\/div>\n<div style=\"color: #666666;\">\u96d6\u7136\u9019\u7a2e\u65b9\u6cd5\u6709\u9ede\u8907\u96dc\uff0c\u4f46\u4e5f\u4e0d\u5931\u70ba\u4e00\u7a2e\u5728\u9801\u9762\u50b3\u503c\u7684\u65b9\u5f0f\u3002<\/div>\n<div style=\"color: #666666;\">\u8209\u500b\u4f8b\u5b50\u770b\u770b\uff1a<\/div>\n<div style=\"color: #666666;\">1\u3001\u5275\u5efa\u4e00\u500bweb form<\/div>\n<div style=\"color: #666666;\">2\u3001\u5728\u65b0\u5efa\u7684web form\u4e2d\u653e\u7f6e\u4e00\u500bbutton1\uff0c\u5728\u653e\u7f6e\u5169\u500bTextBox1,TextBox2<\/div>\n<div style=\"color: #666666;\">3\u3001\u70babutton\u6309\u9215\u5275\u5efaclick\u4e8b\u4ef6<\/div>\n<div style=\"color: #666666;\">\u4ee3\u78bc\u5982\u4e0b\uff1a<\/div>\n<div style=\"color: #666666;\">private void Button1_Click<\/div>\n<div style=\"color: #666666;\">(object sender, System.EventArgs e)<\/div>\n<div style=\"color: #666666;\">{<\/div>\n<div style=\"color: #666666;\">Server.Transfer(&#8220;webform2.aspx&#8221;);<\/div>\n<div style=\"color: #666666;\">}<\/div>\n<div style=\"color: #666666;\">4\u3001\u5275\u5efa\u904e\u7a0b\u4f86\u8fd4\u56deTextBox1,TextBox2\u63a7\u4ef6\u7684\u503c\u4ee3\u78bc\u5982\u4e0b\uff1a<\/div>\n<div style=\"color: #666666;\">public string Name<\/div>\n<div style=\"color: #666666;\">{<\/div>\n<div style=\"color: #666666;\">get<\/div>\n<div style=\"color: #666666;\">{<\/div>\n<div style=\"color: #666666;\">return TextBox1.Text;<\/div>\n<div style=\"color: #666666;\">}<\/div>\n<div style=\"color: #666666;\">}<\/div>\n<div style=\"color: #666666;\"><\/div>\n<div style=\"color: #666666;\">public string EMail<\/div>\n<div style=\"color: #666666;\">{<\/div>\n<div style=\"color: #666666;\">get<\/div>\n<div style=\"color: #666666;\">{<\/div>\n<div style=\"color: #666666;\">return TextBox2.Text;<\/div>\n<div style=\"color: #666666;\">}<\/div>\n<div style=\"color: #666666;\">}<\/div>\n<div style=\"color: #666666;\">5\u3001\u65b0\u5efa\u4e00\u500b\u76ee\u6a19\u9801\u9762\u547d\u540d\u70bawebform2<\/div>\n<div style=\"color: #666666;\">6\u3001\u5728webform2\u4e2d\u653e\u7f6e\u5169\u500bLabel1,Label2<\/div>\n<div style=\"color: #666666;\">\u5728webform2\u7684Page_Load\u4e2d\u6dfb\u52a0\u5982\u4e0b\u4ee3\u78bc\uff1a<\/div>\n<div style=\"color: #666666;\">private void Page_Load<\/div>\n<div style=\"color: #666666;\">(object sender, System.EventArgs e)<\/div>\n<div style=\"color: #666666;\">{<\/div>\n<div style=\"color: #666666;\">\/\/\u5275\u5efa\u539f\u59cb\u7a97\u9ad4\u7684\u5be6\u4f8b<\/div>\n<div style=\"color: #666666;\">WebForm1 wf1;<\/div>\n<div style=\"color: #666666;\">\/\/\u7372\u5f97\u5be6\u4f8b\u5316\u7684\u53e5\u67c4<\/div>\n<div style=\"color: #666666;\">wf1=(WebForm1)Context.Handler;<\/div>\n<div style=\"color: #666666;\">Label1.Text=wf1.Name;<\/div>\n<div style=\"color: #666666;\">Label2.Text=wf1.EMail;<\/div>\n<div style=\"color: #666666;\"><\/div>\n<div style=\"color: #666666;\">}<\/div>\n<div style=\"color: #666666;\">\u904b\u884c,\u5373\u53ef\u770b\u5230\u50b3\u905e\u5f8c\u7684\u7d50\u679c\u4e86<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0ASP.NET\u9801\u9762\u9593\u7684\u50b3\u503c\u7684\u5e7e\u7a2e\u65b9\u6cd5\u00a0\u00a0ASP.NET WEB FORMS \u7d66\u958b\u767c\u8005\u63d0\u4f9b\u4e86\u6975\u597d\u7684\u4e8b\u4ef6\u9a45\u52d5\u958b\u767c &hellip; <a href=\"https:\/\/www.kuki.idv.tw\/?p=2516\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008ASP.NET\u9801\u9762\u9593\u7684\u50b3\u503c\u7684\u5e7e\u7a2e\u65b9\u6cd5\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\/2516"}],"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=2516"}],"version-history":[{"count":1,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2516\/revisions"}],"predecessor-version":[{"id":2517,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2516\/revisions\/2517"}],"wp:attachment":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}