Home  >  Article  >  Backend Development  >  Summary of common methods of passing values ​​in ASP.NET pages

Summary of common methods of passing values ​​in ASP.NET pages

高洛峰
高洛峰Original
2017-01-21 14:42:401120browse

1. Form submission:

 
 
 
 
.... 
form1.submit(); 
....

This method is generally used in HTML pages, not in asp.net, because asp.net forms are always submitted to their own pages.

2. Linking method of A tag

链接地址传送 
接收页面: string str = Request["param1"]

3. Session sharing

发送页面:Session("param1") = "1"; 
按收页面 string str =Session("param1").ToString();

4. Application sharing

发送页面: Application("param1") = "1"; 
按收页面: string str = Application("param1").ToString();

This method is not commonly used because Application is shared within an application domain, and all users can change and set its value, so only counters and other places that require global variables are used.

5. Cookie

6. Response.Redirect() method

Response.Redirect("target.aspx?param1=1¶m2=2") 
接收页面: stringstr = Request["param1"]

7. Server.Transfer() method

Server.Transfer("target.aspx?param1=1¶m2=2") 
接收页面: stringstr = Request["param1"]

More ASP.NET For a summary of common methods of page value transfer, please pay attention to the PHP Chinese website for related articles!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn