WebForm_
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm_
<!DOCTYPE html PUBLIC "
<html xmlns="
<head runat="server">
<title></title>
</head>
<body>
<form id="form
<div>
<asp:Table ID="TableLogin" runat=
<asp:TableRow>
<asp:TableCell><label>用戶名
<asp:TableCell><asp:TextBox ID="UserName" runat="server" Width="
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><label>密碼
<asp:TableCell><asp:TextBox ID="PassWord" runat="server" Width="
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><label>驗證密碼
<asp:TableCell><asp:TextBox ID="ConfimPWD" runat="server" Width="
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><asp:Button ID="Confirm" runat="server" Text="確認" Width="
</asp:TableRow>
</asp:Table>
</div>
</form>
</body>
</html>
WebForm_
<%@ Reference Page="~/WebForm_
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm_
<!DOCTYPE html PUBLIC "
<html xmlns="
<head runat="server">
<title></title>
</head>
<body>
<form id="form
<div>
</div>
</form>
</body>
</html>
WebForm_
using System;
using System
using System
using System
using System
using System
namespace 頁面傳值
{
public partial class WebForm_
{
protected void Page_Load(object sender
{
}
public string un//得到用戶名
{
get
{
return UserName
}
}
public string pwd//得到密碼
{
get
{
return PassWord
}
}
public string conpwd//得到確認密碼
{
get
{
return ConfimPWD
}
}
/// <summary>
/// 向WebForm_
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Confirm_Click(object sender
{
//
//string url = "WebForm_
//Response
//
//Session["un"] = UserName
//Session["pwd"] = PassWord
//Session["conpwd"] = ConfimPWD
//Server
//
//HttpCookie cookie_name = new HttpCookie("un");
//cookie_name
//HttpCookie cookie_pwd = new HttpCookie("pwd");
//cookie_pwd
//HttpCookie cookie_conpwd = new HttpCookie("conpwd");
//cookie_conpwd
//Response
//Response
//Response
//Server
//
//Application["un"] = UserName
//Application["pwd"] = PassWord
//Application["conpwd"] = ConfimPWD
//Response
Server
}
}
}
WebForm_
using System;
using System
using System
using System
using System
using System
namespace 頁面傳值
{
public partial class WebForm_
{
protected void Page_Load(object sender
{
//QueryTransfer();
//SessionTransfer();
//CookieTransfer();
//ApplicationTransfer();
Transfer();
}
public void QueryTransfer()//接收QueryString傳值
{
string strUserName = Request
string strPassword = Request
string strPWD = Request
Response
}
public void SessionTransfer()//接收session傳值
{
string strUserName = Session["un"]
string strPassword = Session["pwd"]
string strPWD = Session["conpwd"]
Response
Session
Session
Session
}
public void CookieTransfer()//接收cookie傳值
{
string strUserName = Request
string strPassword = Request
string strPWD = Request
Response
}
public void ApplicationTransfer()//接收Application傳值
{
Application
string strUserName = Application["un"]
string strPassword = Application["pwd"]
string strPWD = Application["conpwd"]
Application
if (strPassword != strPWD)
{
Response
Server
}
Response
}
public void Transfer()//Transfer傳值
{
WebForm_
wf
string strUserName = wf
string strPassword = wf
string strPWD = wf
Response
}
}
}
本人水平有限
From:http://tw.wingwit.com/Article/program/net/201311/14111.html