Tuesday, August 08, 2006

Sending data to event handler

You can pass any string/list of strings to your event handler by completing these two steps: 1. Web.config definition: <handler type="Custom.TestEvent, PublishEvents" method="OnPublishBegin"> <mystring>teststring</mystring> </handler> 2. In the code you should define a field named mystring and a property with get and set accessors: private string mystring; public string MyString { set { this.mystring = value; } get { return this.mystring; } }


James Gardner said...

Hey Alex, this is dredging this post up from the past but that's one of the reasons why the internet is great. On to my question - Is it possible to pass something other than a string or list of strings? If possible I'd like to pass in a key value pair.

Cheers, and thanks for the great blog.