页面间传值的方法?
2007-08-22 21:43
232 查看
今天参加了个面试一共9道题
1:页面间传值的方法?
<1>通过QueryString[GET]方式
这种方式一般传递安全性不高的简单类型,像Array,Object就不可以传递
Server.Transfer,Server.Execute()
Response.Redirect()
例如:
string url="http://www.baidu.com?UserName="+this.UserName.Text;
<2>使用Application全局变量
例如:
Application.Lock();
Application["UserName"]="Roboth";
Application.UnLock();
<3>使用Session
例如:
Session.Add("UserName","Roboth");
<4>使用Cookie
HttpCookie cookie=new HttpCookie("UserName");
cookie.Value="Roboth";
Response.AppendCookie(cookie);
<5>Server.Transfer
例如:
a.aspx的C#代码
public string Name
private void Button1_Click(object sender, System.EventArgs e)
b.aspx中C#代码
private void Page_Load(object sender, EventArgs e)
<6>Cache
例如:
Cache["prompt"]="Welcome to Olympic's Games"
1:页面间传值的方法?
<1>通过QueryString[GET]方式
这种方式一般传递安全性不高的简单类型,像Array,Object就不可以传递
Server.Transfer,Server.Execute()
Response.Redirect()
例如:
string url="http://www.baidu.com?UserName="+this.UserName.Text;
<2>使用Application全局变量
例如:
Application.Lock();
Application["UserName"]="Roboth";
Application.UnLock();
<3>使用Session
例如:
Session.Add("UserName","Roboth");
<4>使用Cookie
HttpCookie cookie=new HttpCookie("UserName");
cookie.Value="Roboth";
Response.AppendCookie(cookie);
<5>Server.Transfer
例如:
a.aspx的C#代码
public string Name
private void Button1_Click(object sender, System.EventArgs e)
b.aspx中C#代码
private void Page_Load(object sender, EventArgs e)
<6>Cache
例如:
Cache["prompt"]="Welcome to Olympic's Games"
相关文章推荐
- 判断一个页面加载完全完成的准确方法
- web页面打印方法
- ASP 页面 Provider 错误 '80004005' 未指定的错误 的最终解决方法
- OCX调用页面上JavaScript的方法(解决FEvents=nil的问题)
- 在jsp页面上几种取action传入值得几种方法
- html5新特性:利用history的pushState等方法来解决使用ajax导致页面后退和前进的问题
- html5新特性:利用history的pushState等方法来解决使用ajax导致页面后退和前进的问题
- asp.net跳转页面的三种方法比较
- 在web页面上快速生成二维码的三种实用方法
- html5新特性:利用history的pushState等方法来解决使用ajax导致页面后退和前进的问题
- iframe子页面获取父页面元素的方法
- 500错误自定义页面不显示,但404自定义页面显示的解决方法
- javascript调用父窗口(父页面)的方法
- jsp页面中两种方法显示当前时间的简单实例
- ###(很难找的页面错误)查询操作不需要 返回 操作成功后失败。【方法不能同时执行两个response返回两次数据。导致页面显示数据失败】
- 在controller中返回ajax处理后结果,页面显示xmlObjectDocument的解决方法
- JSP页面间传递参数方法介绍
- 在SharePoint Server 2010 的管理中心,点击“配置管理帐户”,就会在ManagedAccounts.aspx页面出现,“对象不存在”的出错信息应对方法!!!!
- 获取页面提交数据的3个方法
- Javascript刷新页面的几种方法(转)