background
I am an ASP., temporarily began to learn ASP. NET, in this record I personally knock code, not much reference value, please see the pots of friends for me to support me a bit, thank you.
Response.Write Redirect
Response.Write () is used to output a string or array of characters to the client, and Response.Redirect is used for redirection, which shows the transfer URL data, which requires two interactions with the client.
The next example is to redirect the input information to another interface and display it.
Create a new web window redirect.aspx, enter <formID= "Form1"runat= "Server"> <Div> <Table> <TR> <TD>User name:</TD> <TD><Asp:textboxrunat= "Server"ID= "Txtname"/></TD> </TR> <TR> <TD>Gender:</TD> <TD><Asp:textboxrunat= "Server"ID= "Txtsex"/></TD> </TR> <TR> <TD> </TD> <TD><Asp:buttonrunat= "Server"ID= "Btnregister"Text= "Register"OnClick= "Btnregister_click" /></TD> </TR> </Table> </Div> </form>
Add a Btnregister_click event in the Redirect.aspx.cs fileprotected voidBtnregister_click (Objectsender, EventArgs e) { stringstrname = This. txtName.Text; stringSex =""; if(Txtsex.text = ="male") {Sex="Mr."; } Else if(Txtsex.text = ="female") {Sex="Lady"; } Response.Redirect ("index.aspx?sname="+ strname +"&sex="+sex); }
Then create a new Wen form index.aspx and write it in the background
protected void Page_Load (object sender, EventArgs e) { string name = request.querystring[" sName"]; string sex = request.querystring["sex"]; Response.Write (Name " + sex +" Welcome registration " ); }
Run effect for output registered personal information
Asp. NET rookie Road of response small example