ASP.NET debugging three axes: second trick
http://www.tongyi.net Author: Wang Hengbin Source: www.51dotnet.com Hits: 2310
The last time we said configuring the config.web file, let the error message give more prompts. What is the use of light prompts? "The most is to know where it is wrong. But I still will not change it!" Don't worry, don't worry, see what our article is called, "three ax", that's of course, a ax! The last trick is not enough, we have the following, so don't happe, and listen to me slowly. Second: Trace tracking ASP should have used the following statement: response.write xxx response.end Although I don't like ASP programming methods, this convenient debugging means is still very good. After exchange for ASP.NET, I found that ASP.NET provides a more powerful debugging method, which is what we are going to say now. The so-called Trace function is to add some tags in the top of the web page, as for what tag? Hey, I can't tell you right away (not good, stinky eggs ... wow!). I said, I have to introduce a little basic knowledge! I don't know how much you know about the page of ASP.NET. For the convenience of explanation below, I still introduce it! ASP.NET's page indicates that the statement enclosed in each ASP.NET page is the top, with <% @ and%>. Its function is to determine what special settings are required when dealing with the ASP.NET file. The specific syntax is as follows: <% @ Directive Attribute = value> where: Directive is the page marker; attribute is some attributes corresponding to the monolith. Note: There is a space between the properties, and there is no space between "=". ASP.NET now contains the following seven identifiers @ Page, @ Control, @ Import, @ registe, @ askEMBLY, @ outputcache, @ WebService we have used the most @ Page label, and now I want to talk about the trace function, Used @ Page. (About these seven indicated specific applications, I will post it later.) Ok, return to our theme. To use Trace features, you must add: <% @ page trace = "true"%> this sentence. After adding, you can look at the operation of the page. Run the page. You will find a lot of data in the lower half of the page. Let's explain the meaning of these data: Request Details: Data read to the browser through the request method; Trace Information: Events or program execution process information; Control Tree: The controls and controls used by the web page Class relationship; cookies collection: Cookie information used by the web page; Headers Collection: The header information of the browser. Server Variables: Data information for Server variables. With this big pile of data, our work is much better, but it is happy, Trace also provides more powerful features, please look down. In addition to making the ASP.NET page display this heap of data, we can also display the value of the variable used in the program in the Trace Information section, which is called Trace.Warn or Trace.Write two methods.