StateManagement Part 2 Using Cookies in Asp.net

No.of Views651
Bookmarked0 times
Downloads 
Votes0
By  usamawahabkhan   On  06 May 2010 20:05:17
Tag : ASP.NET , State Management
There is Lots of ways and Techniques Are available to Manage you State on Web in Aspnet
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

introduction

There is Lots of ways and Techniques Are available to Manage you State on Web in Aspnet


Session management

its will manage user state between server and client like (User Authentication) its keep user Values with unique References on Server in you Apps

Application State management

Application State Manged your Application level Object like( User/Visitor Counter,Number of user online ) in asp.net normally we use to managed application level Object Globe.asmx Class

Managing State On Page

As we know http or html Control our stateless so before asp.net it quit big problem but asp.net provide nice solution for managing page or control state use View_state i will keep you Control State during Server to Client Communication Example if user using html Control for User Registration Form on your Web Site where user have to fill more 16 textboxies then you will check your name from server then Postback server html control lose all data fill by user but in asp.net Control it will keep its data in View_State in encrypted form .

View State:     [Save data in encrypted form in page] Hidden fields [Save data in page]
Cookies :       [Storing Data on Client]
Query String  : [Passing data to next page by URL(defalut.aspx?var=abc)]

 

How is Querstring present in URL

Image Loading

 

Default.aspx

Image Loading
 

Login button click event

Image Loading

Profile.aspx

Image Loading

Profile.aspx.cs

compose simple code in page load event.

 

Image Loading

 Conclusion

In this article , i have shared with you how we could access cookies and check the already a user is authenticated and store token in cookies.andthen read the cookies and process page without re login again and again.

 

Sample Project Source

Download source files -101 kb

 
Sign Up to vote for this article
 
About Author
 
usamawahabkhan
Occupation-Not Provided
Company-Not Provided
Member Type-Senior
Location-Pakistan
Joined date-06 May 2010
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
    Cookie is one of several ways to store data about web site visitors during the time when web server and browser are not connected. They are small files That are created on the client’s hard drive (or, if they’re temporary, in the web browser’s memory).
    Published Date : 02/Jun/2011
    It is a storage mechanism that is accessible from all pages requested by a single Web browser session. Therefore, you can use session state to store user-specific information. A session is defined as the period of time that a unique user interacts with a Web application. Active Server Pages (ASP) developers who wish to retain data for unique user sessions can use an intrinsic feature known as session state.
    Published Date : 02/Jun/2011
    It store global objects that can be accessed by any client.It supports the same types what session state support which are of type objects, retains information on the server, and uses the same dictionary-based syntax. Application state is based on the System.Web.HttpApplicationState class, which is provided in all web pages through the built-in Application object.
    Published Date : 09/May/2011
    Http protocol is stateless, so we need to maintain state on Client side or Server side. For this time I am going to discuss about the maintaining state on Server Side with one programming practice.
    Published Date : 10/Jan/2011
    Now web application framework, no matter how advanced, can change that HTTP is a stateless protocol. So inherently we should also forget our users, but unfortunately we cannot.ASP.Net Framework provides us features by which we can maintain states of your users.
    Published Date : 26/Jun/2010
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top