Hi,
Essentially I'm trying to create a custom event handler for a project that will fire when a user is created/deleted in Kentico and when a role is assigned to that user.
I've been trying to follow the documentation: http://devnet.kentico.com/docs/devguide/index.html?event_handlers_overview.htm
But I have been unable to get it to work.
Here is the test handler I created:
using System;
using CMS.DocumentEngine;
using CMS.SettingsProvider;
using CMS.GlobalHelper;
[CustomUserEvents]
public partial class CMSModuleLoader
{
private class CustomUserEvents : CMSLoaderAttribute
{
public override void Init()
{
UserInfo.TYPEINFO.Events.Insert.Before += User_Inserted_Before;
}
private void User_Inserted_Before(object sender, ObjectEventArgs e)
{
string lines = "This works";
System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\test.txt");
file.WriteLine(lines);
}
}
}
Our project is a web application project so it doesn't have an App_Code folder by default. I've tried creating one, I've put the file in both our project and the associated CMSApp project containing the Kentico application.
Still can't get it to work? It doesn't seem to fire and if I debug I can't see it ever hitting the Init method or anything.
I saw
this thread and read
this blog post that was mentioned there.
Do you have any ideas or can you give me an example of how to do this?
Thanks!