Maybe you have some logic you would like to execute whenever a user signs in. I've implemented a provider model to allow you to plug in handlers so you don't have to modify anything in the core of mojoPortal to accomplish your task. You should always avoid making any customizations to the core of mojoPortal to ensure you will have smooth upgrade path going forward. You can create your handlers in your own projects external to mojoPortal projects.

To create your own User Sign In Event Handler, copy this one, change the class name and namespace and add your custom logic:

using System;
using System.Configuration.Provider;
using System.Collections.Generic;
using System.Text;
using mojoPortal.Business;
using log4net;

namespace mojoPortal.Business.WebHelpers.UserSignInHandlers

public class DoNothingUserSignInHandlerProvider : UserSignInHandlerProvider
private static readonly ILog log
= LogManager.GetLogger(typeof(DoNothingUserSignInHandlerProvider));

public DoNothingUserSignInHandlerProvider()
{ }

public override void UserSignInEventHandler(object sender, UserSignInEventArgs e)
if (e == null) return;
if (e.SiteUser == null) return;

// do nothing
log.Debug("DoNothingUserSignInHandlerProvider called for user " + e.SiteUser.Email);

Now you still have to plug it in so mojoPortal knows about it. Typically, in your external projects you will have a post build event to copy your dlls to the Web/bin. You must also create a config file. You should keep it in your own project (usually the UI project if you have 3 tiers) under /Setup/ProviderConfig/usersigninhandlers/ and add a step to your post build event that will copy it to /Web/Setup/ProviderConfig/usersigninhandlers

So your file might be named mycustomusersigninhandler.config. the syntax for the content of this file is very simple:

<?xml version="1.0" encoding="utf-8" ?>

<add name="YourCustomClassName"
type="YourCustomNamespace.YourCustomClassName, YourAssemblyName"
description="your description" />


Note that YourAssemblyName is the name of the dll containing your handler but without the .dll extension

Last Modified by Joe Audette on Aug 28, 2008