PC Review


Reply
Thread Tools Rate Thread

Custom Exception Handling And Logging using EnterPrise Library app

 
 
Shrikant More
Guest
Posts: n/a
 
      31st Mar 2008
Hi ,
I am looking out for a custom based exception handling and logging
mechanisms using Enterprise library's exception handling and logging
application blocks.I have a class library called Exceptionhandling. I have
created class called Appexception.cs . I have inherited it from
IExceptionHandler.



[ConfigurationElementType(typeof(CustomHandlerData))]

public class AppException : IExceptionHandler
{
Dictionary<string, object> dictionary = new Dictionary<string,
object>();
public AppException(NameValueCollection collection)
{

int count = collection.Count;

}

#region IExceptionHandler Members

public Exception HandleException(Exception exception, Guid
handlingInstanceId)
{

// How can i get the reference of the IDictionary object
return exception;

}

#endregion

}

I also have an Website in which i am adding the reference of the above
class library.The code which i have written in page load is as below,
ublic partial class _Default : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{
try
{
int i, j,k;
i = 5;
j = 0;
k = i / j;

}
catch (Exception ex)
{
ex.Source = ConfigurationManager.AppSettings["SODATEXT"];

Dictionary<string, object> dictionaryError = new
Dictionary<string, object>();
dictionaryError.Add("username ", Shrikant More);
Guid activityId ;
activityId= Guid.NewGuid();
dictionaryError.Add("Activityid",activityId);
dictionaryError.Add("EventID",eventID);
ExceptionPolicy.HandleException(ex, "Exception Policy");

}


Question : How can i pass the dictionary object to the
ExceptionPolicy.HandleException Method. I have added some values to the
dictionary object, i want that values in the HandleException method of the
AppException.Cs class in the and add that vlaues in the windows log
event.How can i achive this mechanism

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Enterprise Library 4.0 Exception Handling Application Block Polly Anna Microsoft Dot NET 1 21st Jun 2008 06:29 PM
exception handling using enterprise library Microsoft ASP .NET 1 14th Oct 2007 02:29 AM
Exception handling in Enterprise Library 2.0 newbee question fsatre@gmail.com Microsoft Dot NET Framework 0 30th Mar 2007 09:32 AM
ASP.NET Exception Handling with the Enterprise Library (Jan 2006) Wade Microsoft ASP .NET 3 25th Jul 2006 06:20 AM
Enterprise Library: Exception Handling Block - how do I get to HandlingInstanceID? levon Microsoft ASP .NET 0 28th Sep 2005 01:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:14 PM.