您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關(guān)get方法和post方法在ASP.NET中有什么區(qū)別,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
ASP.NET 是開源,跨平臺(tái),高性能,輕量級(jí)的 Web 應(yīng)用構(gòu)建框架,常用于通過 HTML、CSS、JavaScript 以及服務(wù)器腳本來構(gòu)建網(wǎng)頁(yè)和網(wǎng)站。
get方法
html頁(yè)面:
<html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>發(fā)送GET請(qǐng)求</title> </head> <body> <center >
發(fā)送GET請(qǐng)求
<hr /> <form action=default7.aspx method =get > 輸入發(fā)送的內(nèi)容: <input type =text name="content1" /> <br /> <input type =submit value ="發(fā)送" /> </form> </center> </body> </html>
對(duì)應(yīng)的aspx頁(yè)面:
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>接收GET請(qǐng)求</title> </head> <body> <center >
接收GET方法傳來的內(nèi)容:
<hr /> <% string content = Request.QueryString["content1"]; Response.Write("GET方法發(fā)送過來的內(nèi)容為:"+content); %> </center> </body> </html>
post方法
html頁(yè)面:
<html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>發(fā)送post請(qǐng)求</title> </head> <body> <center >
發(fā)送post請(qǐng)求
<hr /> <form action =default8.aspx method =post >
輸入發(fā)送的內(nèi)容:
<input type =text name="content1" /> <br /> <input type =submit value ="發(fā)送" /> </form> </center> </body> </html>
對(duì)應(yīng)的aspx頁(yè)面:
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>接收post請(qǐng)求</title> </head> <body> <center >
接收post方法傳來的內(nèi)容:
<hr /> <% string content=Request .Form ["content1"]; Response.Write("POST方法發(fā)送過來的內(nèi)容為:"+content); %> </center> </body> </html>
用get方法,當(dāng)執(zhí)行aspx頁(yè)面時(shí),地址欄的顯示有一段字符“?content1=html輸入的值”,而用post方法,沒顯示,相比之下,post方法比較安全適用。
看完上述內(nèi)容,你們對(duì)get方法和post方法在ASP.NET中有什么區(qū)別有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注億速云行業(yè)資訊頻道,感謝大家的支持。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。