TAILIEUCHUNG - Maintaining State in a Web Application

Maintaining State in a Web Application The Hypertext Transport Protocol (HTTP) doesn't maintain state between pages served by your Web server during each round-trip | Maintaining State in a Web Application The Hypertext Transport Protocol HTTP doesn t maintain state between pages served by your Web server during each round-trip. This means that any information you provided in a form is for-gotten when you get a new page. If you re simply receiving static HTML Web pages then this isn t a problem. If you re placing an order for a product however then the server needs to remember what you ordered. To get the Web server to remember what you did during the last round-trip you can store information on the server or on the client computer the browser is running on. Storing information on the client means you don t use up any resources on the server to store that information and your Web application can potentially handle many more users. Storing information on the server gives you more control of the stored information but since this consumes server resources you need to be careful not to store too much otherwise your Web application won t be able to handle many users. Storing Information on the Client To store information on the client you can use cookies or the Page object s ViewState property. Let s take a look at how you use cookies and the ViewState property. Storing Information using Cookies A cookie is a name and value pair that is stored in a small file that resides on the hard drive of the client computer. You use the name to identify the value being stored both the name and value are string objects. Warning Cookies are potentially problematic because the user can configure their browser to prevent cookies from being stored. Also a browser stores only a limited number of cookies 300 in total and no more than 20 per Web server. You should therefore use cookies sparingly-if at all. The following example creates an int variable named myInt that is set to 1 and creates an HttpCookie object that stores myInt under the name count int myInt 1 HttpCookie myHttpCookie new HttpCookie count Because a cookie stores the .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.