State Management In ASP.NET:
1) CONTEXT:- Context will maintain user Information From Webpage to another when Redirection Takes place.
2) Query String:- Maintaining Using Query String in URL.
3) COOKIES:-
Storing Personnel info at the client system is called cookies
1)In memory Cookie:- This will be stored in browser process, This will be removed after closing the browser.
Syntax: HttpCookie obj=new HttpCookie["n"];
obj.Value="100"
Responce.AppendCookie(obj);
Example: Examination Using Cookies.
2)Persistant Cookie:- This will be stored in Client Harddisk, this will be maintained with a purticuler life time.
Persistent Cookie= Inmemory Cookie+ life time
Syntax: HttpCookie obj1=new HttpCookie["username"];
obj1.Value=textbox1.text;
HttpCookie obj2=new HttpCookie["password"];
obj2.Value=textbox2.text;
obj1.Expires = DateTime.Now.Adddays(2);
obj2.Expires = DateTime.Now.Adddays(2);
Responce.AppendCookie(obj1);
Responce.AppendCookie(obj2);
Example: Remember My login check box
LIMITATIONS:
1) Not Secured because Browser maintains Data In a text file.
2) Browser can store only 4KB data for each in total 20 maximum towards website.
3) Browser can store only total 300 maximum towards diff websites.
4) SESSIONS:-
Web server Allocating block of memory unique to client on web server is called Session memory.Session Timeout is 20 min by
default.there are three methods
1) Session.Add("n",100);
2) Session.Remove("n");
3) Abandon
Example : Shopping Cart Applications,
Themes Applications..,Etc
5) Application Memory:
When A website is started web server will allocate a block of memory common to all the clients, This is called Application
memory.there are four methods
1)Add.- Application.Add("n",100);
2)Remove.- Application.Remove("n");
3)Lock.- locking for the particular client request.
4)Unlock.- Releasing for all client requests.
Examples: Number of users connected..,etc
GLOBAL.ASAX:
Sessions and applications events to be placed with in special file called "global.asax"
Example: chatting application.
No comments:
Post a Comment