设为首页收藏本站

嘻皮客娱乐学习网

 找回密码
 中文注册
搜索
打印 上一主题 下一主题
开启左侧

[面试题库] ASP.NET 中页面传参的几种方法

[复制链接]
跳转到指定楼层
楼主
发表于 2014-11-30 15:47:33 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
答案:①.表单提交:

…………
Form1.submit();
……
此种方法在ASP。NET中无效,因为asp.net 的表单总是提交到自身页面,如果要提交到别一页面,需要特殊处理
②.连接地址传送:接收页面:string str=Request[“param1”]
③.Session共享发送页面:Session(“param1”)=”1111”; 接收页面:string str=Session(“param2”).ToString();
④.Application 共享:发送页面:Application(“p1”)=”1111”;
接收页面:string str= Application(“p1”).ToString();
此方法不常使用,因为Application 在一个应用程序域范围共享,所有用户可以改变及设置其值,故只应用计数器等需要全局变量的地方
⑤.Cookie
⑥.Response.Redirrct()方式:Response.Redirrct(“target.aspx?p1=1111?m2=2222”)
接收页面:string str=Request[“p1”]
⑦.Server.Transfer()方式:Server.Transfer(“target.aspx?p1=1111?m2=2222”);
接收页面:string str=Request[“p1”]
回复

使用道具 举报

小黑屋|手机版|嘻皮客网 ( 京ICP备10218169号|京公网安备11010802013797  

GMT+8, 2024-6-8 15:46 , Processed in 0.189336 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表