views:

94

answers:

2

I use SqlWebEventProvider to log the exceptions to sql server, and it works fine.

I also want to log custom exceptions to aspnet_WebEvent_Events table programmatically. Similar to - http://fredrik.nsquared2.com/viewpost.aspx?PostID=107&showfeedback=true

WebBaseEvent.Raise(new WebErrorEvent("My Error message", null, 5000, e)); I get an error saying "Cannot access constructor 'WebErrorEvent' here due its protection level.

Appreciate your comments...

A: 

The constructor for class WebErrorEvent is private. You can't instantiate an object of this class.

Take a look at Using Access Modifier private with Constructor in the article titled What are constructors in CSharp - A Step Ahead Series?.

Leniel Macaferi
+1  A: 

If you wish to log custom events, you may consider creating your own event by inheriting from one of the predefined event classes found in System.Web.Management.

Here is a good reference written by Scott Mitchell. It is pretty easy to follow http://www.4guysfromrolla.com/articles/062707-1.aspx

cecilphillip