1. Trang chủ
  2. » Công Nghệ Thông Tin

Asp.net slide11

28 204 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Nội dung

Asp.net slide

Session 21Debug and deploy a Web Application Exploring ASP.NET / Session 21 / 2 of 28ReviewASP.NET is a collection of all the ASP.NET pages, the custom controls, and modulesIt provides the configuration files to customize the web site.The ASP.NET configuration files are written in XML, which enables the developer to modify them using an XML parser.Two types of configuration files exist in ASP.NET: Machine.Config Web.ConfigA hierarchical structure can be formed with every directory, configuring the files present within them with their own Web.Config files. Exploring ASP.NET / Session 21 / 3 of 28Review Contd…Within the configuration tags, the configuration information is grouped into two categories:The configuration section handler declaration area The configuration section settings area.The process of validating the user name and password is known as Authentication. Exploring ASP.NET / Session 21 / 4 of 28ObjectivesTrace an ASP.NET applicationDebug an ASP.NET applicationExplain Data and Output cachingDeploy Caching into an application Exploring ASP.NET / Session 21 / 5 of 28TracingThe process of locating errors in a code is known as tracing Tracing is a new feature of ASP.NET, as previous versions of ASP did not support tracingTracing in ASP.NET is provided at two levels:Page-Level TracingApplication-Level Tracing Exploring ASP.NET / Session 21 / 6 of 28Page-Level TracingThe intrinsic controls like Trace are used to write custom debugging statements These statements appear at the end of the output that is delivered to the client Apart from just inserting statements at the end of the clients’ output, ASP.NET also provides a few methods like Init and Pre Render, which print messages in the trace ‑information block of the page To enable page level debugging for a page, the following page directive has to be included at the beginning of the page code. <%@ Page Trace = “True” TraceMode=“SortByCategory” %> Exploring ASP.NET / Session 21 / 7 of 28Page-Level Tracing Example<% @Page Trace="True" TraceMode="SortByCategory" %><html> <head> <title>Page level Tracing</title> </head> <body><h1>A Program to test Trace .</h1> </body></html>Request Information Exploring ASP.NET / Session 21 / 8 of 28Trace Information CategoriesCategoryDescriptionRequest DetailsLists all the information of the requestTrace InformationLists information from standard and custom trace statementsControl Tree Lists all of the items in the pageCookies CollectionLists all of the cookies of the page with their valuesHeader Collection Lists all the items of the HTTP headerForm Collection Lists all of the form elements and their values being POSTed.Server VariablesLists all the server variables and their values Exploring ASP.NET / Session 21 / 9 of 28Trace Example<% @ Page Trace="True" TraceMode="SortByTime" %><html> <head> <title>Trace Methods</title> </head> <body><script language="C#" runat="server">void Page_Init() {Trace.Warn ("Page Init Event: Message from Page Init"); } void Page_Load(Object Sender, EventArgs E) {Trace.Write ("Page Load Event: Message from Page Load"); } Exploring ASP.NET / Session 21 / 10 of 28Trace Example - Output </script><h1>A Program to test Trace .</h1> </body></html> [...]... all users True Exploring ASP.NET / Session 21 / 14 of 28 Debugging an Application    In spite of the tracing options provided by ASP.NET, bugs may still creep into the programming logic of an application ASP.NET provides high-end debugging, that enables the developer to step through the code line by line, and see how the actual execution takes place In order to configure the ASP.NET application to... MyDataGrid.DataBind(); } Exploring ASP.NET / Session 21 / 24 of 28 Data Caching Example Caching Data Exploring ASP.NET / Session 21 / 25 of 28 Data Caching Output Exploring ASP.NET / Session 21 / 26 of 28...Checking Trace Sometimes at runtime, it may be necessary to check if trace in an ASP.NET page is enabled The IsEnabled property of the Trace object can be used for checking this … if(Trace.IsEnabled) { Trace.Warn (“Inside the Init proc! ”); } … Exploring ASP.NET / Session 21 / 11 of 28 Application Level Tracing      Used for tracing an entire application Provides... the application pages After requesting a page, the debugger has to be launched by typing DbgClr.exe in the Run dialog box or the command prompt Exploring ASP.NET / Session 21 / 16 of 28 Debug window with the code  After invoking the debugger, the ASP.NET source file that needs to be debugged should be opened  The next step is to open the Processes dialog box, by clicking on the Tools menu, and then... Request, Response, and Session Exploring ASP.NET / Session 21 / 17 of 28 Caching   Caching is a technique used to increase performance, by keeping frequently accessed data in memory In the case of a web application, caching is used to retain pages or data across HTTP requests, and reuse them without the expense of recompiling them Types of Caching Exploring ASP.NET / Session 21 / 18 of 28 Output Caching... Exploring ASP.NET / Session 21 / 19 of 28 Output Caching Example void Page_Load(Object Src, EventArgs E) { TimeGen.Text = DateTime.Now.ToString ("G"); } Use of Output Cache This page was generated on: Exploring ASP.NET. .. pageOutput=“true” /> Exploring ASP.NET / Session 21 / 12 of 28 Application Level Tracing Example Once this is coded, every page will display trace information Trace.axd file in the application root directory displays the information related to entire application Exploring ASP.NET / Session 21 / 13 of... user Deploying a ASP.NET application is very simple The application directory and files need to be copied from the development environment to the production environment, where the application will go live XCOPY can be used to copy the files from source to destination The following syntax shows how to use the XCOPY command to copy files XCOPY Exploring ASP.NET / Session... lightweight debugger that is perfectly suited for debugging  Caching is a technique used to increase performance by keeping frequently accessed data in the memory .ASP.NET supports two types of caching, they are:  Output Caching  Data Caching Exploring ASP.NET / Session 21 / 28 of 28 ... the page is requested, the SlidingExpiration property (of the class) can be set as follows Response.Cache.SetExpires(DateTime.Now.AddSeconds(120)); Response.Cache.SetSlidingExpiration (true); Exploring ASP.NET / Session 21 / 21 of 28 Data Caching    Data caching provides a simple dictionary interface, that allows programmers to easily place objects in, and retrieve them from the cache Placing an item . and deploy a Web Application Exploring ASP. NET / Session 21 / 2 of 28Review ASP. NET is a collection of all the ASP. NET pages, the custom controls, and modulesIt. known as Authentication. Exploring ASP. NET / Session 21 / 4 of 28ObjectivesTrace an ASP. NET applicationDebug an ASP. NET applicationExplain Data and Output

Ngày đăng: 15/11/2012, 14:44

Xem thêm

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN