Monday, May 21, 2012

Introduction to State Management

State management is the process by which you maintain state and page information over multiple requests for the same or different pages.


Types of State management:

  • Client side state Management
  • Server side state management

Client side State Management :
    This stores information on the client's computer by embedding the information into a Web page, a URLor cookie.Following  techniques are available to store the state information at client side:
            1. Cookies: 
                      Cookies store a value in the user's browser that the browser sends with every page request to the same server. Cookies are the best way to store state data that must be available for multiple Web pages on a web site. 
         
            2. View State: 
                     Asp.Net uses View State to track the values in the Controls. You can add custom values to the view state. It is used by the Asp.net page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is to restore view state. 


         3.Control State: 
                    If you create a custom control that requires view state to work properly, you should use control state to ensure other developers don’t break your control by disabling view state. 


Server side State Management: 
        1.Application State - Application State information is available to all pages, instead of which user requests a page. 

        2.Session State – Session State information is available to all pages opened by a user during a single visit. 

Introduction to ASP.NET


ASP.NET 

ASP.NET is a server-side technology for creating dynamic, standards-based Web sites and services that are accessible across multiple platforms including mobile devices. It is part of the .NET-based environment; you can author applications in any .NET compatible language, including Visual Basic .NET, C#, and J#. Additionally, the entire .NET Framework class library is available to any ASP.NET application


  • An ASP.NET page is a server-side text file saved with the .aspx extension. The internal structure of the page is extremely modular and comprises three distinct sections page directives, code, and page layout
 

  • Page directives: Page directives set up the environment in which the page will run, specify how the HTTP runtime should process the page, and determine which assumptions about the page are safe to make. Directives also let you import namespaces to simplify coding, load assemblies not currently in the global assembly cache (GAC), and register new controls with custom tag names and namespace prefixes.

  • Code section
    The code section contains handlers for page and control events, plus optional helper routines. Any source code pertinent to the page can be inserted inline or attached to the page through a separate file. 
  • Page layout
    The page layout represents the skeleton of the page. It includes server controls, literal text, and HTML tags. The user interface of the server controls can be fleshed out a bit using declared attributes and control properties.