tailieunhanh - Professional ASP.NET 3.5 in C# and Visual Basic Part 79

Professional in C# and Visual Basic Part 79. Building on the revolutionary release, adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 15 Personalization Listing 15-11 Setting an anonymous cookie in the HTTP header HTTP 200 OK Server Development Server Date Sat 11 Feb 2008 19 23 37 GMT X-AspNet-Version Set-Cookie .ASPXANONYMOUS UH5CftJlxgEkAAAAZTJkN2I3YjUtZDhkOS00NDE2LWFlYjEtOTVj MjVmMzMxZWRmHoBU As9A055rziDrMQ1Hu_fC_hM1 expires Sat 22-Apr-2008 06 03 36 GMT path HttpOnly Cache-Control private Content-Type text html charset utf-8 Content-Length 1419 Connection Close From this HTTP header you can see that a cookie .aspxanonymous is set to a hashed value for later retrieval by the personalization system. Changing the Name of the Cookie for Anonymous Identification Cookies are used by default under the cookie name .aspxanonymous. You can change the name of this cookie from the anonymousIdentification element in the file by using the cookieName attribute as shown in Listing 15-12. Listing 15-12 Changing the name of the cookie configuration anonymousIdentification enabled true cookieName .ASPXEvjenWebApplication configuration Changing the Length of Time the Cookie Is Stored Also by default the cookie stored on the end user s machine is stored for 100 000 minutes which is almost 70 days . If you want to change this value you do it within this anonymousIdentification element using the cookieTimeout attribute as shown in Listing 15-13. Listing 15-13 Changing the length of time the cookie is stored configuration anonymousIdentification enabled true cookieTimeout 1440 configuration 737 Chapter 15 Personalization In this case the cookieTimeout value was changed to 1440 meaning 1 440 minutes or one day . This would be ideal for something like a shopping cart where you do not want to persist the identification of the end user too long. Changing How the Identifiers Are Stored Although anonymous identifiers are stored through the use of cookies you can also easily change this. Cookies are by far the preferred way

TỪ KHÓA LIÊN QUAN