Response对象的Redirect方法重定向的功能.并向重定向的url传递参数

xiaoxiao2026-03-18  7

    protected void Button1_Click(object sender, EventArgs e) //A页面    {        //Response对象的Redirect方法重定向的功能.并向重定向的url传递参数        string name = txtname.Text.Trim();        string sex = "先生";        if (RadioButton2.Checked)            sex = "小姐";        Response.Redirect("Welcome.aspx?Name="+name+"&Sex="+sex);    }

 

 

public partial class Welcome : System.Web.UI.Page //B页面{    protected void Page_Load(object sender, EventArgs e)    {        string name=Request .Params["Name"];        string sex=Request .Params["Sex"];        Response.Write("欢迎"+name+sex+"!");    }}

 

 

 

转载请注明原文地址: https://www.6miu.com/read-5046090.html

最新回复(0)