Summary of commonly used methods for ASP page value

Source: Internet
Author: User
One, form submission:

<formaction= "target.aspx" method = "POST" name = "Form1" > <input name = "param1" value = "1"/> <input name = "param2" value = "2"/> </form> .... form1.submit (); ....

This method is typically used in HTML pages, not in ASP. NET, because the form of ASP. NET is always submitted to its own page.

Second, the link of a label way

<ahref= "target.aspx?param1=1¶m2=2" > Link address Transfer </A> receive page: string str = request["param1"]

Third, session sharing

Send page: Session ("param1") = "1"; On the collection page, string str =session ("param1"). ToString ();

Iv. Sharing of application

Send page: Application ("param1") = "1"; By Collection page: String str = Application ("param1"). ToString ();

This method is not used very often, because application is shared in an application domain, and all users can change and set their values, so only apply the counters, etc. where global variables are required.

V. Cookies

Vi. Response.Redirect () mode

Response.Redirect ("target.aspx?param1=1¶m2=2") receive page: Stringstr = request["param1"]

Seven, Server.Transfer () way

Server.Transfer ("target.aspx?param1=1¶m2=2") receive page: Stringstr = request["param1"]

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.