通过URL链接地址传递方式1
- send.aspx:
- protected void Button1_Click(object sender, EventArgs e)
- {
- Request.Redirect("Default2.aspx?username=honge");
- }
- receive.aspx:
- string username = Request.QueryString["username"]; //这样可以得到参数值。
通过URL链接地址传递方式2
- send.aspx:
- protected void Button1_Click(object sender, EventArgs e)
- {
- Request.Redirect("Default2.aspx?username=honge");
- }
- receive.aspx:
- string username = Request.QueryString["username"]; //这样可以得到参数值。
- private void Button1_Click( object sender, System.EventArgs e )
- {
- string s_url;
- s_url = "b.aspx?name=" + Label1.Text;
- Response.Redirect( s_url );
- }
- b.aspx中C#代码
- private void Page_Load( object sender, EventArgs e )
- {
- Label2.Text = Request.QueryString["name"];
- }