用session["变量名"]存储可以;
我也见过,用网页传值的方法
但是忘了
Default2.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>get方法 URL中能看见值,汉字乱马</title>
</head>
<body>
<form action="webfrom1.aspx" method ="get">
<table style="width: 344px; left: 67px; position: relative; top: 73px; height: 130px;" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 76px">
</td>
<td style="width: 158px">
</td>
<td style="width: 149px">
</td>
</tr>
<tr>
<td style="width: 76px; height: 26px;">
</td>
<td style="width: 158px; height: 26px">
<input id="Text1" type="text" name="userpwd" /></td>
<td style="width: 149px; height: 26px;">
</td>
</tr>
<tr>
<td style="width: 76px; height: 23px;">
</td>
<td style="width: 158px; height: 23px">
<input id="Submit1" type="submit" value="提交" /></td>
<td style="width: 149px; height: 23px;">
</td>
</tr>
</table>
</form>
</body>
</html>
webfrom1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="webfrom1.aspx.cs" Inherits="webfrom1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server" method ="post">
</form>
</body>
</html>
webfrom1.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class webfrom1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string pwd = Request["userpwd"].ToString();
Response.Write(pwd);
}
}
Default.aspx.cs
protected void Button1_Click(object sender, EventArgs e)
{
string s_url;
s_url = "Default2.aspx?name=" + TextBox1.Text;
Response.Redirect(s_url);
}
Default2.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = Request.QueryString["name"];
}
Default3.aspx页面
Server.Transfer("default4.aspx");
在default4.aspx页面html添加<%@ PreviousPageType VirtualPath="~/Default3.aspx" %>页指令
然后类似下面通过ID获取a.aspx页面的控件等信息
Button btn = (Button)Page.PreviousPage.FindControl("Button5");
郁闷,VS2003里面不能用,不然页面传对象方便多了,省了N个Session`~~~
[此贴子已经被作者于2007-8-1 16:58:45编辑过]