ASP.NET 頁面?zhèn)髦党S梅椒偨Y(jié)
更新時間:2013年08月27日 16:27:04 作者:
ASP.NET 頁面?zhèn)髦档姆绞接泻芏?,本文整理了一些比較常用方法,大家可以根據(jù)自己需求自由選擇
一、表單提交:
復(fù)制代碼 代碼如下:
<formaction= "target.aspx" method = "post" name ="form1">
<input name = "param1" value ="1"/>
<input name = "param2" value ="2"/>
</form>
....
form1.submit();
....
這種方法一般用于html頁面中,不用于asp.net中,因?yàn)閍sp.net的表單總是提交到自身頁面。
二、A標(biāo)簽的鏈接方式
復(fù)制代碼 代碼如下:
<Ahref="target.aspx?param1=1¶m2=2">鏈接地址傳送</A>
接收頁面: string str = Request["param1"]
三、Session共享
復(fù)制代碼 代碼如下:
發(fā)送頁面:Session("param1") = "1";
按收頁面 string str =Session("param1").ToString();
四、Application共享
復(fù)制代碼 代碼如下:
發(fā)送頁面: Application("param1") = "1";
按收頁面: string str = Application("param1").ToString();
此種方法不常使用,因?yàn)锳pplication在一個應(yīng)用程序域范圍共享,所有用戶可以改變及設(shè)置其值,故只應(yīng)用計數(shù)器等需要全局變量的地方。
五、Cookie
六、Response.Redirect()方式
復(fù)制代碼 代碼如下:
Response.Redirect("target.aspx?param1=1¶m2=2")
接收頁面: stringstr = Request["param1"]
七、Server.Transfer()方式
復(fù)制代碼 代碼如下:
Server.Transfer("target.aspx?param1=1¶m2=2")
接收頁面: stringstr = Request["param1"]
您可能感興趣的文章:
相關(guān)文章
在應(yīng)用程序級別之外使用注冊為allowDefinition=''MachineToApplication''的節(jié)是錯誤的
在應(yīng)用程序級別之外使用注冊為 allowDefinition='MachineToApplication' 的節(jié)是錯誤的2009-03-03Asp.Net中的數(shù)據(jù)源概述與配置及實(shí)例代碼
數(shù)據(jù)綁定分為數(shù)據(jù)源和數(shù)據(jù)綁定控件兩部分,數(shù)據(jù)綁定控件通過數(shù)據(jù)源來獲得數(shù)據(jù);接下來本文將分別介紹下數(shù)據(jù)源/數(shù)據(jù)綁定控件/ObjectDataSource2013-02-02C#中efcore-ShardingCore呈現(xiàn)“完美”分表
本文簡單的介紹了efcore的分表,著重介紹了efcore下最完美的分表組件ShardingCore,可以幫助大家更好的學(xué)習(xí),感興趣的小伙伴可以參考一下2021-08-08asp.net core webapi 服務(wù)端配置跨域的實(shí)例
下面小編就為大家分享一篇asp.net core webapi 服務(wù)端配置跨域的實(shí)例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2017-12-12