Using the ASP.NET CookieParameter
Object
The CookieParameter
object represents a browser-side cookie. The CookieParameter
includes all the properties of the base Parameter
class and the following additional property:
• CookieName
—
The name of the browser cookie.
The page in Listing 9.19 illustrates how you can use the CookieParameter
object. The page contains a voting form that you can use to vote for your favorite color. A cookie is added to the user’s browser to identify the user and prevent someone from cheating by voting more than once (see Figure 9.12).
Figure 9.12. Vote on your favorite color.
Listing 9.19. Vote.aspx
The cookie is ...
Get ASP.NET 4 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.