Differences between transferring values between pages and redirecting between pages in Asp.net

Source: Internet
Author: User

Jump to B. aspx in A. aspx
Difference between server. Transfer ("B. aspx") and response. Redirect ("B. aspx ")
If it is through the server. transfer () in. aspx jumps to B. aspx, then in B. the ASPX page can be found and saved in. the value in the control in the ASPX page, if it is response. redirect (),. the value of the control in the ASPX page.
If you use server. Transfer ("B. aspx"), you can notify the following method to obtain the value that is retained in A. aspx, such as label and hiddenfield. CopyCode The Code is as follows: hiddenfield hforderid = new hiddenfield ();
Hiddenfield hfpaymoney = new hiddenfield ();
If (page. previouspage! = NULL)
{
Try
{
//
// Find the master page,
Masterpage = (masterpage) page. previouspage. controls [0];
//
// Search for containers
Contentplaceholder = (contentplaceholder) masterpage. findcontrol ("contentplaceholder3 ");
System. Web. UI. usercontrol = (system. Web. UI. usercontrol) contentplaceholder. findcontrol ("myorder1 ");
//
// Find the corresponding data transmission hiddenfield
Hforderid = (hiddenfield) usercontrol. findcontrol ("hforderid ");
Hfpaymoney = (hiddenfield) usercontrol. findcontrol ("hfpaymoney ");
//
// Obtain the incoming order number
String strorderid = hforderid. value;
String strpaymoney = hfpaymoney. value;
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.