Home  >  Article  >  Backend Development  >  Spread Zhike ASP.NET basic series video material sharing

Spread Zhike ASP.NET basic series video material sharing

巴扎黑
巴扎黑Original
2017-08-31 11:44:351530browse

ASP.NET has all the solutions for developing website applications, including all functions such as validation, caching, state management, debugging and deployment. In terms of code writing, the feature is to separate page logic and business logic. It separates program code and displayed content, making it easier to write colorful web pages. At the same time, the program code looks cleaner and simpler.

"Spread Zhike ASP.NET Basics Series Video Tutorials" ASP.NET is an enterprise Web application development technology platform led by Microsoft. It is currently one of the most popular Web development technologies and can develop various complex functions. website. In order to allow students with zero foundation to learn professional web development technology in the shortest time through the Internet and benefit from it.

Spread Zhike ASP.NET basic series video material sharing

Video playback address: http://www.php.cn/course/623.html

The difficulty of this video is :

1. The principle of ViewState


1. The browser requests the Default.aspx page

2. The created ViewState is found on the server side at this time A hidden field named __VIEWSTATE (double underscores are all capital letters)
will be automatically created. The value of the hidden field is encrypted by base64 and returned to the browser. This encryption process is in the SaveState event of the page life cycle
. Completed in the SaveAllState method

3. When the browser submits the form, the hidden field of __VIEWSTATE is also submitted to the server. At this time, the ReadState event of the page life cycle
's ReadAllState method will encrypt The final value is base64 decrypted and finally the value is assigned to the ViewState named name

4. Finally, operate the value in ViewState

2. ViewState usage:

1 .Define the ViewState attribute

public int PageCount{
get{return (int)ViewState["PageCount"];}
set{ViewState["PageCount"]=value;}
}

2. Conditions for using ViewState

If you want to use ViewState, there must be a server-side form tag in the ASPX page (

). Form fields are required so that hidden fields containing ViewState information can be passed back to the server. Moreover, the form must be a server-side form so that the ASP.net page framework can add hidden fields when the page is executed on the server.

The EnableViewState property value of the page is true

The EnableViewState property value of the control is true

3. Things to note about ViewState

a. When a page exists When posting back, ViewState must be disabled if there is no need to maintain the value of the control.
b. ViewState indexes are case-sensitive.
c. ViewState is not cross-page.

d. In order to be saved in ViewState, the object must be streamable or have a TypeConverter defined.
e. When the TextMode property of the control TextBox is set to Password, its state will not be saved in ViewState. This should be for security reasons.
f. Do not use ViewState when the page has no postbacks or redirects or transfers to other pages on postbacks.

g. Be careful about its ViewState when dynamically creating a control.
h. When the ViewState of a program is disabled, the ViewState of all pages of the program is also disabled.
i. ViewState is persistent only when the page posts back to itself.

4. Set ViewState

ViewState can be set in controls, pages, programs, and global configurations. EnableViewState is true by default. If you want to disable the ViewState function of all pages, you can set EnableViewState to false in the program configuration.

The above is the detailed content of Spread Zhike ASP.NET basic series video material sharing. For more information, please follow other related articles on the PHP Chinese website!

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