Post on 30-Mar-2015
Current Popular IT IPertemuan 10
Matakuliah : T0403/Current Popular IT ITahun : 2008
Learning Outcomes
• Learner can do state management• Learner can use Cookie, Session, and Profile• Learner can choose between server-side and
client-side state management
Bina Nusantara Copyright © Surya Sujarwo 2008
Material Outline• Using Browser Cookies• Using Session State• Using Profiles• ASP.NET Request-Processing Architecture• ASP.NET and Server-Side State Management• ASP.NET and Client-Side State Management• A Client State Workshop• Form Post Data and ASP.NET Controls• ASP.NET Control State• Caching Application Pages and Data• Optimize Application and Session State Management
Bina Nusantara Copyright © Surya Sujarwo 2008
Using Browser Cookies
• Create :• Expire:• Read:
• Remove:
Bina Nusantara References: ASP.NET 3.5 Unleashed (Stephen Walther, 2008)
Using Session State
• Create:• Read:
• Remove:
Bina Nusantara References: ASP.NET 3.5 Unleashed (Stephen Walther, 2008)
Using Profiles
• Add profile:
• Using profile:
• Add group:
• Using group:
• From code:Bina Nusantara References: ASP.NET 3.5 Unleashed (Stephen Walther, 2008)
ASP.NET Request-Processing Architecture
• ASP.NET request data flow
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
ASP.NET Request-Processing Architecture (Continue…)
• ASP.NET request processing classes
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
ASP.NET and Server-Side State Management
• The Context Object
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
Property Description
Application Provides server-side state management for all clients of the web Application
ApplicationInstance
Reference controls the execution process of the ASP.NET web request
Cache Provides access to the server-side cache in ASP.NET
Error Provides access to the error exceptions that occur during ASP.NET execution
Items Key/value pair collection used to pass information between the components in a request
Request Contains information from the client request, including browser type, cookies, and values encoded in form and URL query string collections
Response Key/value pair collection used to pass information between therequesting components
Server Provides utilities including Server.Transfer, Server.HtmlEncode, and Server.MapPath
Session State collection maintained on behalf of a web application user
Trace Debugging utility for writing to the trace output of the web form
User Makes security information available when a user is authenticated
ASP.NET and Client-Side State Management
• URL strings
• Cookies• HTML Hidden Variables
• ViewState
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
ASP.NET and Client-Side State Management
• ASP.NET Postback Mechanism
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
A Client State Workshop
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
A Client State Workshop (Continue…)
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
A Client State Workshop (Continue…)
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
Form Post Data and ASP.NET Controls
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
Form Post Data and ASP.NET Controls
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
ASP.NET Control State
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
ASP.NET Control State (Continue…)
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
ASP.NET Control State (Continue…)
Bina Nusantara References: ProASP.NET 3.5 Server Controls and AJAX Components(Rob Cameron and Dale Michalk, 2008)
Caching Application Pages and Data
• Page Output– Varying by Parameter (QueryString)– Varying by Control
• Partial Page Caching– Post-Cache Substitution
Bina Nusantara References: ASP.NET 3.5 Unleashed (Stephen Walther, 2008), Pro ASP.NET for SQL Server (Brennan Stehling, 2007)
Caching Application Pages and Data (Continue…)
– Post-Cache Substitution (continue…)
– Advantages using WriteSubstitution() method• Can be method of other class• Can be use in custom control
Bina Nusantara References: ASP.NET 3.5 Unleashed (Stephen Walther, 2008), Pro ASP.NET for SQL Server (Brennan Stehling, 2007)
Caching Application Pages and Data (Continue…)
– Caching with user control
Bina Nusantara References: ASP.NET 3.5 Unleashed (Stephen Walther, 2008), Pro ASP.NET for SQL Server (Brennan Stehling, 2007)
Caching Application Pages and Data (Continue…)
• DataSource Caching
• Data Caching
Bina Nusantara References: ASP.NET 3.5 Unleashed (Stephen Walther, 2008), Pro ASP.NET for SQL Server (Brennan Stehling, 2007)
Caching Application Pages and Data (Continue…)
• Data Caching (continue…)
Bina Nusantara References: ASP.NET 3.5 Unleashed (Stephen Walther, 2008), Pro ASP.NET for SQL Server (Brennan Stehling, 2007)
Optimize Application and Session State Management
• Application State– This is information that applies to all clients of the Web
application. This information is shared by, and managed for, multiple clients.
• Session State– This is information that applies to a specific client
session. You manage this information for individual clients.
• Setting Session State
Bina Nusantara References: Performance Tuning and Optimizing ASP.NET Applications (Jeffrey Hasan and Kenneth Tu, 2003)
Optimize Application and Session State Management (Continue…)
• Setting Session State (continue…)
Bina Nusantara References: Performance Tuning and Optimizing ASP.NET Applications (Jeffrey Hasan and Kenneth Tu, 2003)
Mode Description
InProc (default) which stores session state in memory on the Web server
StateServer stores session state in a separate process called the ASP.NET state service
SQLServer stores session state in a SQL Server database
Custom enables to specify a custom storage provider
Off disables session stateCookieless
modeDescription
AutoDetect ASP.NET determines whether the requesting browser or device supports cookies
UseCookies Cookies persist user data, regardless of whether the browser or device supports cookies
UseDeviceProfile
ASP.NET determines whether to use cookies based on the HttpBrowserCapabilities setting
UseUri The calling feature uses the query string to store an identifier, regardless of whether the browser or device supports cookies
Optimize Application and Session State Management (Continue…)
• Choosing the right ASP.NET State Management Option– Session State:
• Does the application require centralized session state management, or can it be managed on individual Web servers?
• Does the application require cookie-based or cookieless session state?
• What kind of information needs to be stored?• Does the application really need a Session object for all
information?
– Application State:• Does the application require permanent application state? • Does the application require transient application state?• How frequently will stored items be updated?• Does the client need direct access to the item?
Bina Nusantara References: Performance Tuning and Optimizing ASP.NET Applications (Jeffrey Hasan and Kenneth Tu, 2003)
That’s AllThank You for the Attention
Bina Nusantara