Tuesday 30 April 2013

State Management

Web and HTTP protocol are stateless. Hence server cant identify whether or not two requests came from same user and server will treat every request as the request from a new user. Because of the stateless nature of the web it is not possible to develop applications like shopping cart and implementing security in the websites. To overcome this problem, Asp.Net provides state management techniques. Client Side State Management techniques include Cookies, Viewstate and QueryString Parameters and Server side state management techniques include Session, Application and Caching.

 COOKIES

A cookie is a small amount of memory allocated on client system for storing personnel information about the client like remembering user id and password, making a count of failed login attempts, security and also session state management. To create a cookie use HttpCookie class and to assign a value to the cookie use its Value property and finally to store it in a client system call AppendCookie() method of Response object.