Download presentation
Presentation is loading. Please wait.
Published byShinta Kurniawan Modified over 5 years ago
1
ASP.NET 4.0 State Management Improvements – Deep Dive
1/15/2019 5:14 PM 18th December 2010 ASP.NET 4.0 State Management Improvements – Deep Dive Abhijit Jana Consultant | Microsoft COMMUNITY Community Tech Days - Hyderabad © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
2
Agenda Overview ASP.NET State Management Improvement in ASP.NET 4.0
View State More Control Over View State Session Compress Out Process Session Data State Server Session Mode SQL Server Session Mode Change Session Mode at Runtime Caching Output Cache Provider | ASP.NET 4.0
3
Overview of ASP.NET State Management
Web is stateless Every page is recreated for each request ASP.NET State Management Preserved the data during PostBack. few selection criteria to selected proper way to maintain the state How much information do you need to store? Do you want to store the information on the client or on the server? Is the information sensitive? What performance and bandwidth criteria do you have for your application? Do you need to store information per user? How long do you need to store the information? Do you have a Web farm (multiple servers), a Web garden (multiple processes on one machine), or a single process that serves the application? State Management Client Side Hidden Field Cookies Query String View State Control State Server Side Session Application Object Caching | ASP.NET 4.0
4
More Control Over ViewState
1/15/2019 5:14 PM More Control Over ViewState Abhijit Jana Consultant | Microsoft © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
5
More Control Over ViewState
The ASP.NET ViewState is a client side state management ViewState stored in hidden field by searching __VIEWSTATE keyword By default, ViewState is serialized into a base-64 encoded string On PostBack ViewState Info Loads and reapply the persisted state to the Control on Control Hierarchy Disadvantage - Page Size EnableViewState property used to enabled or disabled the ViewState . EnableViewState always take precedence of Page Directives values. ASP.NET 4.0 Introduced ViewStateMode properties with pages and controls. ViewStateMode helps developer to take control for each and individual control Page_PreInit Page_Init Load View State Load Post Back Data Page_Load Page Post back event Pre Render Save View State Render Unload | ASP.NET 4.0
6
More Control Over ViewState
1/15/2019 5:14 PM More Control Over ViewState Abhijit Jana Consultant | Microsoft © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
7
Compress Out Process Session Data
1/15/2019 5:14 PM Compress Out Process Session Data Abhijit Jana Consultant | Microsoft © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
8
Compression Enabled Session
Process Request (w3wp.exe) Compress/ Decompress Session Server Side State Management For every Client Session data store separately Asp.Net use 120 bit identifier to track each session Web Server Creates the Session ID and stored it inside State Provider to refer it next time We can have In Process, State Server, SQL Server and Custom Session Provider Based on session data size performance can decreased. For SQL Server and State Server Data needs to be serialized while store and during retrieve need to desterilized ASP.NET 4.0 Introduced CompressionEnabled session mode for State Server and SQL Server Useful for Web farm scenarios and large amount of data Client Request for Page and store some information in Session. Next Time Client request for same data Web Server Creates a secure ID for session and started it in state provider Server takes the session ID and passed it to Session provider State Provider Store Client Data separately. Send data to server based on session id. | ASP.NET 4.0
9
Compress Out Process Session Demo
1/15/2019 5:14 PM Compress Out Process Session Demo Abhijit Jana Consultant | Microsoft © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
10
Change Session Mode at Runtime
1/15/2019 5:14 PM Change Session Mode at Runtime Abhijit Jana Consultant | Microsoft © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
11
Change Session Mode at Runtime
How ASP.NET actually determines whether session state should be used for a page? We can enabled or disabled session state either from page Directives or Web.config Till ASP.NET 3.5 We don’t had any option to override the session state at runtime. In ASP.NET 4.0 we can change the session mode at runtime using SetSessionStateBehavior methods using HTTPModule The SessionStateBehavior enumeration Required, ReadOnly and Disabled and Default values. You need to call this method before AcquireRequestState | ASP.NET 4.0
12
Change Session Mode at Runtime Demo
1/15/2019 5:14 PM Change Session Mode at Runtime Demo Abhijit Jana Consultant | Microsoft © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
13
Output Cache Provider Abhijit Jana Consultant | Microsoft
1/15/2019 5:14 PM Output Cache Provider Abhijit Jana Consultant | Microsoft © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
14
JIT Compiler > Native Code > HTML
ASP.NET Caching MSIL JIT Compiler > Native Code > HTML One of the most Important ways to improve a web application's performance. ASP.NET Provides Two types of Caching Output Caching Data Caching Both types of Cached data stored in server memory. We can set dependency on Cache Item In Output Caching we can Cache the whole page or part of the page ( Fragment Caching) Output caching can be configured based on duration, params Cached version of the page can be sent in response without running the page Cached ASPX Page
15
Output Cache Provider Cache Provider | ASP.NET 4.0
Extending ASP.NET Output Caching Custom Cache Provider Implements OutputCacheProvider Add() , Get(), Remove(), Set() Can be store File System, DB, In Memory, Cloud Cache Provider | ASP.NET 4.0
16
Output Cache Provider Demo
1/15/2019 5:14 PM Output Cache Provider Demo Abhijit Jana Consultant | Microsoft © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
17
Thank You !!! Abhijit Jana Consultant | Microsoft
1/15/2019 5:14 PM Thank You !!! Abhijit Jana Consultant | Microsoft © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.