Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Cuối cùng, chúng tôi kiểm tra một tính năng ASP.NET 2.0 giới thiệu với các đối tượng hồ sơ. Các đối tượng hồ sơ cung cấp cho bạn một phương thức của việc tạo ra một hình thức kiểu mạnh và liên tục của trạng thái phiên. Bạn học được phương pháp khác nhau xác định một hồ sơ. Bạn cũng tìm hiểu cách sử dụng các đối tượng hồ sơ từ trong một thành phần. Cuối cùng, bạn tìm hiểu làm thế nào để thực hiện một nhà cung cấp hồ sơ hải quan. | 1264 CHAPTER 28 Maintaining Application State Finally we examine a feature introduced with ASP.NET 2.0 the Profile object. The Profile object provides you with a method of creating a strongly typed and persistent form of session state. You learn different methods of defining a profile. You also learn how to use the Profile object from within a component. Finally you learn how to implement a custom Profile provider. Using Browser Cookies Cookies were introduced into the world with the first version of the Netscape browser. The developers at Netscape invented cookies to solve a problem that plagued the Internet at the time. There was no way to make money because there was no way to create a shopping cart. Here s how cookies work. When a web server creates a cookie an additional HTTP header is sent to the browser when a page is served to the browser. The HTTP header looks like this Set-Cookie message Hello This Set-Cookie header causes the browser to create a cookie named message that has the value Hello. After a cookie has been created on a browser whenever the browser requests a page from the same application in the future the browser sends a header that looks like this Cookie message Hello The Cookie header contains all the cookies that have been set by the web server. The cookies are sent back to the web server each time a request is made from the browser. A cookie is nothing more than a little bit of text. You can store only string values when using a cookie. You actually can create two types of cookies session cookies and persistent cookies. A session cookie exists only in memory. If a user closes the web browser the session cookie disappears forever. A persistent cookie on the other hand can last for months or even years. When you create a persistent cookie the cookie is stored permanently by the user s browser on the user s computer. Internet Explorer for example stores cookies in a set of text files contained in the following folder Documents and Settings .