Presenter:Bob Tabor (from LearnVisualStudio.NET)
In this lesson, you will learn how to debug and monitor your ASP.NET 2.0 Web applications.
Click here to go to original video page
The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video
Minute 0
And is less a talk about how to debug your Web applications and how to monitor each webpage and how it performed internally by using the powerful functionality of visual Web developer 2005 express edition and ASP net 2 0 well in most challenging aspects of creating web based applications versus writing Windows forms applications at lease in the past was the lack of tools to support debugging so that he could watch the code as it s executing that generates the dynamic webpages to watch it and step through a line by line and typically have to resort to writing out for race values at the top or the bottom of your webpage to get some feedback so you can narrow down which line or which lines of code or causing problems within your Web application
Minute 1
Taken a whole other level when deploying the web application and I personally spent long hours trying to track down obscure bugs that only occurred in certain situations only to find out that it only occurred on people served in web browsers were disabled this and enable bad and so on talk about a frustrating meticulous line of work so visual Web developer 2005 express edition makes it super easy to debug your applications during development time and fact it works almost identically to debugging tools that you re used to using whatever your building rifle regular Windows applications in Visual Basic 2005 you can set and manage breakpoints you can view the values of variables of locals windows and watch windows and a lot more also ASP net 2 0 provides a tracing tool that makes monitoring how well your applications are functioning snap super easy and finally this lesson on the show hot as
Minute 2
A default error page day you can use to give the user a friendly notice that something bad just happened instead showing of an ugly error page is generated automatically by the Web server you want to make it very friendly and show them the nice venture in control at all times and so were to demonstrate how to do that very simple to do in ASP net ago of a slow start off by talking about debugging I m going to go crazy websites were going to call this one lesson 05 and was to create a really really really simple example here so we can dismiss Red Hat set breakpoints in and step through code so if you select this to my strings for a my straining equals and let s do this go back to our interface here are in a drag and drop text box and call this
Minute 3
First text box and they were also put a label on here or call this the result label read whole lot with this boost want to deal with rights included a something old and meaningful for first text box to text and result label the sense equals my strength and and facts sir to change the game to him and learn more control of the double click bat and tickle this code and school trick your arms to move at all by dragging and dropping it to a new event handler premia okay so how are we going to work with this code say we just
Minute 4
Pointed a breakpoint would worry and debug those whenever we clicked this little green arrow to start debugging what we can do is stop the execution of code ever reaches a certain line and instep line by line by line through our source code in an actually monitored the values that are stored in each of our variables are within each of the properties of our objects and so on and so this particular case in line 12 stop the execution of the code by placing a breakpoint at hot I do this how to put this will read here in the left column and then the redline ice are merely just clicked next to the line that I wanted to place a breakpoint I can also use the F9 key on my keyboard at a remove this all you do is click again and it s gone as a token on cocoa up a far right click this I can temporarily disabled to
Minute 5
Points and it is click it again in order to get back a while I wanted his work is a hell lot of reports my application was developed over long Time it is makes it easier for me to management reports and know that own the past I wanted to own to monitor this particular code is not from a breakpoint on going to close my start debugging button and asked me you want to enable debugging for this web application yes click okay and now working in a web browser but this is not just a web browser s web browser that will pay attention to the fact that we have hit a breakpoint so on the type of some inherent in click by button and unnoticed I have my flashing visual Web developer application in the background went also the starting node is now bad in the left hand column here and it on top of my little red ball I have a yellow arrow in my red line turned into yellow line that tells me that this is the next
Minute 6
On his code is to be executed and now I can use little debug toolbar overture or music use my keyboard to step through the next line of code so in this case I can step into the code so we have some method calls this would go into those method calls or we can step over method calls and just remain in this particular method are button click event or five deep down in some method call and I m not really been addressed was going on at this point I can step out of method calls on a click of these prisons to click the step into button and notice how I clicked a one time that it moved to the code so this line of code is executed my strain should now have the values that I typed into my text box and notice also that hover my mouse cursor over the various aspects of this case the property text of the object first Xbox but it is whole Intel says Poppel
Minute 7
In that shows you the values I can even usable magnifying glass and change the type of visualizer arms to leave its way that it is because the text is wiser works in this particular case but if our world parsing of XML or something I m a look at a slightly different way of same is true here for my variables in this case my strain and it shows me the value that s in my string happens be the same value that said I ll the text property of the first Xbox policyholder result label text of a hover my mouse for sure that currently the text property is set to label we never change the default value is about to be set to devalue my strain after we execute this line of code by clicking our step into button before I do that let s talk about his old windows are typically docked to the lower left hand corner of our visual Web developer 2005 express edition IDE
Minute 8
List are the locals know some of the locals tab and notice that it has a list of the objects that are available in the back of variables that are available for my applications so you see here my string is listed with the value that s currently equal to the vet it also has some these other objects like me for example you recall in Visual Basic the syntax of the the object me rather refers to the current class that were currently in so in this case it would refer to what the_default class tubulin uses the plus button to roll down and view more information that is contained all the sub objects of the child objects all the properties and methods that belong to the me objects you see this quite a few and I can even drill down further into a cache object something that
Minute 9
Things that nature a lot of this Islamic law says that would be useful to us at this point and as we develop more complex applications you ll find that this is an valuable to have access and deliver view at any point in time the current state of these particular objects as they have buried capsule waiting a very sings within our application for example you notice that the sender is one of the objects that are passed in and in this case the sender is a button objects we can see things about the button object sender was our button and you can see for example to see the text property of it which was simply button and if it had a tool tip we would see it right there and some of the information that was visible in story will inspect the properties of the objects on
Minute 10
In our form open social watch Windows little bit different whereas locals window gives us everything watchmen will only give us those values that we want to keep an eye on so what you do is just like for example select my string and I want to monitor the value my strength throughout the course of the execution of the application of a drag and drop what I highlighted down into my watch window and now I m watching my shrink so let s go ahead and continue to run this application and not to change this value up to some other wacky characters are just hard to keep one click my button again and noticed that whenever I reenter my button one click event that my strain because it s declared and not initialize the value is really nothing is as ICQ does code it changes the value to the assignment to the value of
Minute 11
Of the text property of first text box so we have of court for core okay that is assigned in no sessions and read that means in the previous executed line of code something changed about this variable to the same would be true to locals with no self it appears the value per read there as well that is says that something just changed off a click step into a more time noticed now that goes back to Black that means the previous line of code nothing was changed to a bow to my string value so we can continue on from there and how neat is it that now are able to watch what goes on inside of our web applications as their handling the request from from Web browsers like I said in the past in the previous lesson that the lifetime of your web application is a fraction of a second so it s difficult to monitor what s going on is a drabble patients
Minute 12
As with this makes us of retail leased while you re developing your applications okay so the debugging tools within visual Web developer 2005 express edition handle the situation were rashly building our website and try to find problems that exist during the overtime but what if we have already deployed our web application and get reports from some users that their spirit sings the difficulty that they run into some errors are website and only happens in strange rare occurrences were not able to easily track down the problems whenever we re debugging oral machine Hockley s clues to what is actually going on behind the scenes with our application will be blogging in no breakpoints only take us so far will need a doozy of a monitor our applications is there a live production environment and so the way they ASP net 2 0 handles as to the use of some tracing functionality and someone who s close us down
Minute 13
And I m enable tracing for our web applications so they can see some of the the neat functionality that s there are tools or actually see up there go website ASP net configuration so this is the be our first view of the ASP net website ministration tool and the slower to revisit and deny several lessons it allows us to configure things about our web applications it is a separate tools not part of our website but it allows us to manage things about our website okay so for starters Rick Cook on his application to have and notice in the lower right hand corner that we get this little section called about and tracing so we can configure debugging and tracing for our web application and click that link and what he gives us are several options on notice that debugging is already been enabled for application but we have not been able to capture and tracing information to
Minute 14
Click that right now and that will allow was dense to configure some more details about how we want to display the tracing information is captured so I put this to start off with display tracing information of individual flake pages and we can also then determine whether we should only display tracing information for local requests meant that we are basely running this from the Web server on the same box as a Web server as opposed to all requests which means that anybody from any of a web browser across the Internet would really see the trace information probably don t want to do that in most cases can expose information we may not want people to see what it also sort some of the trace results relieved of all of this information to their default values for right now answer click the back button in to minimize this and an outdoor runner up can get with
Minute 15
Room at an runner up location and when I do notice that I will live a difficult situation are using ex boss running into something I get all this tracing information to get these request details of the trace information so all the steps that are conducted during the VS the construction of our webpage to the Korean mixed up initialization and it completes preload begin load and unload and so on until the all entire webpages constructed and you can see here that it also gives us the time that it took to complete these different steps of this may not mean a whole lot to just yet but as you get into your a farther to your career developing ASP net webpages to find some useful information
Minute 16
Peer may be where the whole is if your application performing slowly we can also see the control tree and this is a the page contains controls in some controls contain other controls and so we can see information about those controls and out what information is stored within that we can view any session state application state request cookies or response cookies we look to be in the HUP header information that was sent from the web browser to our web application any response information the form collection query string the server variables and all the information that s contained they re so good as wealth of information about this page request and every time that we run this page we must get a slightly different some slightly different numbers and the based on what information is in foot to her application with the values of cookies on
Minute 17
These things would be able to be displayed here we can monitor and see what is the input for this application and if there was a problem like we ran to exception would be able to see that listed here as well or even know that just as so close that down for an hour to expand on this limitation at this point has been the fact that we are able to view all the trace information on the page but in a real life situation we would want to see what others are doing on our website so we need to change them the configuration settings and click configure to plugging into trace information were times and let s do this time this time we are going to select all requests but we re going to deselect display trace information of individual pages
Minute 18
A pic so let s now go ahead and say this and click the back button to minimize our hour of web application configuration tool and then run the application again now knows his time at all the trace information went away and this would be good insomuch that other users were actually consuming my website wouldn t be able see the trace information but the problem is I can t see the tracing information either and the neat thing is that there s actually another webpage that we can browse to missiles go ahead and grab This URL and paste it in your web browser instead of default that is PS for when tie fingers traced out a XD which is a special
Minute 19
On a token that when accepted by the eighth minute runtime engine knows that we want to be able to view the application trace so we re actually able to view you can see here this application of this page when it was Ron and we can look at the details of that page and see the similar tracing for nation at now on a subsequent request let s go ahead and refreshed at a school fact refresh this he seen others to page requests and relive the Suite 1 paint very cool so we can set how many pages are cats and body is redundant runtime engine is I think our current setting to look at our web application administration tool of our current setting is the only key the last 10 pages of
Minute 20
Changed at 22050 pages whatever we wish course will be used for memory time that we select the larger number of pages to cash and be able to review but now I can watch and just keep hitting the refresh button and watch as people are hitting pages on my website or I can clear the current phrase so that all of the history is on and that is that refresh this page is in refresh my application for a second seat again and so very need very useful and I ve used this so many times on own websites to monitor where the problems are that are difficult to detect whenever I m working on my own personal copy on my own desktop machine knows encloses down the something neat that I can do here if I am running into problems I might want to out
Minute 21
But some information to x ray screen programmatically so in this particular case for him to do is use this line of code which I ve just are rewritten and I pasted it into my zones going to refer to lots of its use to using the trace option members an object up along to page objects we could do page tracer just racist is the case writes this is something that I wrote to you could use us about a problem I can see at what point is this line of code getting hit my code and I can add a number of trace statements to my source code to determine to select for several print out the value of variables or to print out their value at this particular outline of code as the code is executing solus go ahead run the application again and database now that I ve won that page once is good or trace out its DC
Minute 22
And pick the most recent one and here I should see in the begin load between a begin loan the unload is something I wrote I could use this to the problem that was a strain that I wrote out so I can write all messages and put any kind of values I want to hear the help me debug or keep track of how well or how poorly my applications are performing were the running into problems and so forth of this and I wanted to is demonstrate how to handle a problems that occur on my website so in this singular case I have added a line of code that I know I can force to break my website was good and run the application comes with its Bob and click the button and when I do
Minute 23
You can see here that I get this format exceptionalism handled by the user code now unfortunately I was in debug mode source go ahead and tried out of development stopped the executioner s application and was aroused to this is to view in browser and seed we can employ that okay so this is what your end users would see if they use their web browser browses webpage typed in it it made off of value that you were not expecting to handle from the end user so missed his attorney do multiplication by type and the letters each IH you notice whatever I typed randomly on my keyboard so HIH times three equals well nothing you know I have a format exception answer you can see here that I did is really informational but ugly
Minute 24
Are error our users to deal with C of this type of inner message we would like to make it a little bit more like the rest of our website and explain to the user sorry there was a problem will look into why this happened if you keep experiencing this problem please notify the webmaster where the case might be what we re friendly face on a certain message to look I do ongoing to add a new item to tour website is at a simple issue help you to call this error put click add and then his error page instead is something very simple sorry you saw this room where are experiencing hanging problems please try again and we might grow company logo looking silver website may be a link of another area the website if you try maybe the link to the
Minute 25
They ll address of the webmaster and so forth but it s basically a friendly page op ed now how can I make back page appear whenever an exception occurs well to rebuild back to our and he did indeed Web application administration tool and what a click is defined default error page little running for instead of user folder message on the specify URL to use as the foliar page to select our air for HTML and select a click the save button in the fall or page setting has been saved in denial is going to navigate back for a webpage that we had before can sit her down to Stefan Bono equipped button and you can see that I did mine friendly error page
Minute 26
Of excellent closes down and talked a little bit more about this website administration tool now while the website administration tool seems to do a lot for us is really just a friendly face a friendly web based interface that sits on top of a hand in important file that we talked about briefly their previous video called the west config file the web config file as a series of XML settings that a define how our application will run especially some of the features of a street in a General Howell become column I will be applied to our particular application so you can see here that we have present was custom errors tag that sets the default redirect to air htm so what we re made of setting in a horror
Minute 27
Website administration tool we went to the application tab clicked on the five defined default error page that this is what we saw all but behind the scenes it was setting this property here in the web config file to same thing is true for the tracing is enabled and is the only local locally visible true or false and so there are for simple every time we clicked the that we click the OK button to the Bulgar applications this tab was added to our app compilation debug it was true at so some of these things seem very mysterious and very cool the behind the scenes all is at least in this case all this application is really doing is making some settings within our web config file which is really doing of all the work is setting
Minute 28
Engine will use to determine out what features to enable in order to allow us above our application to trace through it security setting things of that nature also minister and more of his own this lesson learned quite a bit about how to locate the problems that pop up while were developing or him for bed after we deploy the website by uploading it to the Web server to be viewed by millions of people to look at the integrated debugging tools and the really cool tracing tools are built in ASP net two out there looked at how to send our web visitors to a friendly error page when things go bad on her website finally talked about is begun at configuration application and how it is really just a nationally interface on top of an XML configuration file called Web config so enjoy this video if you enjoy it please visit www two net to download and watch or former videos
Minute 29
Levels on many different topics related to see shark Visual Basic ASP net and more like he
Thursday, May 29, 2008
Video: Debugging and Tracing Your Website VB
Labels:
debugging and tracing
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment