This course was meant to be shared with the group's brothers. Because the relationship of time has not been fulfilled, today on the Internet and everyone to study together. Please point out the wrong place.
1. ViewState
ViewState is an attribute in asp.net that is used to save a state value for a generated page in a hidden field. When the page is uploaded back to the server, the server resolves, validates, and applies the data in ViewState to restore the page's control tree. ViewState is a very useful feature that can persist the state of a client without using cookies or server memory. Most server controls use ViewState to persist the state values of those elements that interact with the user in the page. • The use of ViewState will bring some negative effects. First, it enlarges the server's response and requests the time. Second, the time to serialize and deserialize data is increased for each postback. Finally, it consumes more memory from the server. • Closes the viewstate of the specified page;
You can disable viewstate for the entire web by webconfig
<configration>
<system.web>
<pages enableviewstate= "false"/>
</system.web>
</configuration>
ViewState is encoded using BASE64 encoding.
The enableViewStateMac property indicates:
True if the asp.net should run the message authentication Code (MAC) on the page's view state when the page is postback from the client, otherwise false. The default is False. • The view state MAC is the encrypted version of the hidden variable that the page's view state is saved to when it is sent to the browser. If true, checks the encrypted view state to verify that the view state has not been tampered with on the client. Do not set enableViewStateMac to true if the primary consideration is performance. If the page view is tampered with, these states are no longer used to restore the page.
2. Performance in page jump
The requested procedure:
1 browser aspx file request---> Server execution---> encounter response.redirect statement-> server send Response.Redirect address to client side browser---> Browser requests to execute a new address
2 browser aspx file request-> Server execution-> encounter Server.Transfer statement-> server to new file
You can see Server.Transfer less than Response.Redirect the process of sending back the server and requesting the client again.
Jump object:
1 Response.Redirect can switch to any existing Web page.
2) Server.Transfer can only switch to the same directory or subdirectory of the Web page.