Add trace calls throughout page tracewritemyapp

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: application or just that page Trace.Mode: SortByTime, SortByCategory Implemented in System.Web.TraceContext class Tracing Page-Level Tracing To enable tracing for a single page: 1. Add trace directive at top of page <%@ Page Trace=“True” %> 2. Add trace calls throughout page Trace.Write(“MyApp”, “Button Clicked”); Trace.Write(“MyApp”, “Value: ” + value); 3. Access page from browser 10 Tracing Application-Level Tracing To enable tracing across multiple pages: 1. Create web.config file in application root <configuration> <trace enabled=“true” requestlimit=“10”/> </configuration> 1. 2. Hit one or more pages in the application Access tracing URL for the application http://localhost/MyApp/Trace.axd Tracing Tracing Example Example: Trace1.aspx Show information obtained from tracing 11 Outline IIS Web Applications Configuration Tracing State Management Caching Error Handling State Management The Problem How/where to store data? How can you pass data from page to page? How do we get around HTTP statelessness? 12 State Management Three-Tier Architecture Client Store the data on one or more of the physical tiers Web Servers Data can be per-user permanent, per-user (session) or per-application Database State Management Client Client-side state management means this: Client requests an initial page The server generates a HTTP/HTML response that is sent back to the client This response includes data (state) User looks at the response and makes a selection, causing another request to the server This second request contains the data that was sent in the first response The server receives and processes the data Could be same server or different server 13 State Management Client URL in a hyperlink (<a>) Query string Very visible to users This can be good or bad Hidden form elements Like __VIEWSTATE Cookies Limited to 4K May be blocked by users State Management Web Server (Middle-Tier) Application variables Shared by all sessions (users) Session variables Still need to pass session id through the client ASP.NET State Service or database Application State Session State Session State Session State 14 State Management In ASP.NET ASP.NET supports both Application-level and Session-level state management Allows you to store state (data) in middle tier State Management Application Variables Application state is stored in an instance of HttpApplicationState Accessed from Page.Application property Can lock Application object for concurrent u...
View Full Document

Ask a homework question - tutors are online