Monday, March 3, 2014

COOKIES

COOKIES IN .NET

DESCRIPTION:

       The cookies are the collection of text to be stored on the user or clients computers and used by the websites when ever it want to reuse them.

Normally in web application it is required to maintain the users input for any website, cookies comes handy on that scenario.
In this example I would like to tell, how we can save the background color of user's choice.

The asp page contains the simple dropdownlist which each time gets postback when selected values are changed.

Step1: On the design page









It has 3 kinds of colors, when the selected value is changes the colorselected_indexchanged method will be executed, 

Step 2: On the code behind page



Now run the application and you will see the color you have choosen at first time remain saved on the webpage for an hour eventhough the page has been loaded everytime on sele.

Example: 



It will change after the given time expires.


No comments:

Post a Comment