Net application http is a stateless sessionless

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: se Needed only when changing application variable Again, use this wisely Use in “read-mostly” style Initialize in global.asax 15 State Management Sessions What is a session? Context in which a user communicates with a server over multiple HTTP requests Within the scope of an ASP.NET Application HTTP is a stateless, sessionless protocol ASP.NET adds the concept of “session” Session identifier: 120 bit ASCII string Session events: Session_OnStart, Session_OnEnd Session variables: store data across multiple requests State Management Session Identifier By default, session id stored in a cookie Can optionally track session id in URL Requires no code changes to app All relative links continue to work <configuration> <sessionState cookieless=“true”/> </configuration> 16 State Management Session Variables ASP stores session state in IIS process State is lost if IIS crashes Can’t use session state across machines ASP.NET stores session state: In process In another process: ASP.NET State Service In SQL Server database <sessionstate inproc="false" server=“AnotherServer" port="42424" /> <sessionstate inproc="false" server=“AnotherServer" port="42424" usesqlserver=“true” /> State Management Session Variables ASP.NET approach provides: Ability to recover from application crashes Ability to recover from IIS crash/restart Can partition an application across multiple machines (called a Web Farm) Can partition an application across multiple processes (called a Web Garden) 17 State Management Application & Session Variables Example: Session.aspx State Management Transfering Control Between Pages Link to a page Postback Response.Redirect Causes HTTP redirect Tells browser to go to another URL Server.Transfer Like a redirect but entirely on one server Server.Execute Execute one page from another then return control Both pages processed on same server 18 Outline IIS Web Applications Configuration Tracing State Management Caching Error Handling Caching Many sites spend considerable effort generating the same web pages over and over For example, a product catalog changes overnight, but is accessed tens of thousands of times a day Server-side caching can vastly improve performance and scalability ASP.NET provides support for Page output caching Data caching 19 Caching Page Output Caching Entire web page output (HTML) is cached Must specify life of cached page (in seconds)...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online