The problem of image jump and value transfer has been plagued by developers who have just come into contact with the asp.net web application. The following lists the jump methods and value transfer methods for your reference; I am involved in a single project, and may have a narrow understanding of this. I hope you will give me more tips to help me improve. This article serves as an example for our new project team members to discuss with you.
The method for redirecting from an asp.net web screen is as follows:
1. Server. Execute
Server. execute cannot be fully regarded as the screen jump method. It is the method for dynamically calling the page and rendering its content to reflect to the current page. transfer and so on for a comparison. When a page with an "include" relationship is used for dynamic calling, for example, WebForm2.aspx is represented in the latter image as part of WebForm1.aspx, you can declare <% Server. execute ("~ /WebForm2.aspx ") %> implementation.
2. Server. Transfer
The most resource-saving frame jump method saves the URL query string and form information of the front image, and uses PreviousPage to query the frame attributes before the jump in the target image. Server. HTTP requests are not generated during the Transfer process, so they are not captured by the HTTP Module and HTTP Handler and cannot be written to the processor. In essence, the server directly performs page "switching ", therefore, the client URL is incorrectly displayed, causing a series of problems, such as the URL Relative Path Problem and Sitemap problem.
3. Response. Redirect
This command will directly return to the client and redirect to the target page through URL, compared to the Server. transfer has one more round-trip between the client and the server, because it is purely URL redirection and cannot save the pre-screen status. Generally, you can use the URL to query the string or Session value for passing the value.
4. PostbackUrl attributes
When an http post request is sent to the next screen, the status of the screen before the jump can be saved. The problem is that the POST occurs on the client and the server cannot implement verification and cancel the jump logic.
5. HTML link
URL redirection. The disadvantage is that, like PostbackUrl, values can only be transmitted through URL query strings on the client.
The method for transferring the value of asp.net web screen jump is as follows::
1. URL-based value transfer
Because of the limited URL length, a large amount of data cannot be transmitted. Encryption is required for sensitive data.
2. Pass the form http post Value
The form attribute is returned to the server in the http post mode. The status of the front screen can be saved and queried through the PreviousPage attribute.
3. Pass the value in the PreviousPage attribute
In fact, the form content will be pushed to the Server through screen jump using Server. Transfer and http post. Therefore, you can obtain the front image information through this attribute after the jump.
4. Pass the Session Value
The cost is relatively high. You need to note that the object is explicitly logged out when the life cycle of the Session variable is not required. This provides a good solution for data sharing between clusters, however, it takes 25% to save Session variables in the database, which requires the performance of Web servers and database servers.
The above introduces the implementation of asp.net web screen jump and the solution to the value transfer problem.
- ASP. NET DetailsView displays the details of the selected product
- ASP. NET 2.0 data Tutorial: select a row in the GridView
- ASP. NET 2.0 data Tutorial: display data in the GridView
- Add the GridView to the page in ASP. NET 2.0
- Notes for adding an ASP. NET page