O'Reilly logo

Special Edition Using® Microsoft® ASP.NET by Richard Leinecker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sample HttpModule

Now it is time to put everything together into a useful HttpModule. The HttpModule implemented in this chapter is a module to log all unhandled errors to a file. If the log file exceeds a certain size, an event is raised. You then can resize or delete the log file with an event handler implemented in the Global.asax file.

This module logs the time of the error, the error message, and the filename, including the line number that generated the error.

The event raised in the Global.asax file contains extra data in a class derived from the System.EventArgs class. This HttpModule will read its initialization data from either the web.config file or the machine.config file. The initialization data contains the filename, including ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required