Table of Contents

Class Standard.User

Namespace
Dynamicweb.Notifications
Assembly
Dynamicweb.dll
Provides notification names for Users.
public sealed class Standard.User
Inheritance
Standard.User
Inherited Members

Examples

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Notifications.Standard.User.OnExtranetLogin)]
    public class OnExtranetLogOnObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
        {
            if (args == null)
                return;

            if (!(args is Dynamicweb.Notifications.Standard.User.OnExtranetLoginArgs))
                return;

            Dynamicweb.Notifications.Standard.User.OnExtranetLoginArgs item = (Dynamicweb.Notifications.Standard.User.OnExtranetLoginArgs)args;
            //Pass user name to the notification e-mail
            string emailBody = string.Format("The user ({0}) has been logged-in.", item.User.Name);

        }
    }
}

Fields

OnAfterLogin

Occurs when the user successfully logged in
[Obsolete("Use Dynamicweb.Notifications.Standard.User.OnExtranetLogin and Dynamicweb.Notifications.Standard.User.OnExtranetLoginFailed")]
public const string OnAfterLogin = "DWN_STANDARD_USER_OnAfterLogin"

Field Value

string

Remarks

This notification is obsolete.

OnBeforeExtranetLogin

The on before extranet login event
public const string OnBeforeExtranetLogin = "DWN_STANDARD_USER_OnBeforeExtranetLogin"

Field Value

string

OnBeforeExtranetLogOff

User before extranet LogOff notification. Occurs when user is logging off, but before the user have been logged out and the session is killed.
public const string OnBeforeExtranetLogOff = "DWN_STANDARD_USER_OnBeforeExtranetLogOff"

Field Value

string

Examples

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Notifications.Standard.User.OnBeforeExtranetLogOff)]
    public class OnBeforeExtranetLogOffObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
        {
            if (args == null)
                return;

            Dynamicweb.Notifications.Standard.User.OnBeforeExtranetLogOffArgs onBeforeExtranetLogOffArgs = args as Dynamicweb.Notifications.Standard.User.OnBeforeExtranetLogOffArgs;

            //Add code here

        }
    }
}

Remarks

OnBeforeForgotPassword

Forgotten password notification. Occurs before user is found in database.
public const string OnBeforeForgotPassword = "DWN_STANDARD_USER_OnBeforeForgotPassword"

Field Value

string

Remarks

OnExtranetLogin

User extranet login notification. Occurs when the user successfully logged in
public const string OnExtranetLogin = "DWN_STANDARD_USER_OnExtranetLogin"

Field Value

string

Examples

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Notifications.Standard.User.OnExtranetLogin)]
    public class OnExtranetLogOnObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
        {
            if (args == null)
                return;

            if (!(args is Dynamicweb.Notifications.Standard.User.OnExtranetLoginArgs))
                return;

            Dynamicweb.Notifications.Standard.User.OnExtranetLoginArgs item = (Dynamicweb.Notifications.Standard.User.OnExtranetLoginArgs)args;
            //Pass user name to the notification e-mail
            string emailBody = string.Format("The user ({0}) has been logged-in.", item.User.Name);

        }
    }
}

Remarks

OnExtranetLoginFailed

User extranet login failed notification. Occurs when authorization failed
public const string OnExtranetLoginFailed = "DWN_STANDARD_USER_OnExtranetLoginFailed"

Field Value

string

Examples

using Dynamicweb.Security.UserManagement;
using System;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Notifications.Standard.User.OnExtranetLoginFailed)]
    public class OnExtranetLogOnFailedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
        {
            if (args == null)
                return;

            if (!(args is Dynamicweb.Notifications.Standard.User.OnExtranetLoginFailedArgs))
                return;

            Dynamicweb.Notifications.Standard.User.OnExtranetLoginFailedArgs item = (Dynamicweb.Notifications.Standard.User.OnExtranetLoginFailedArgs)args;
            //Throw exception if login is incorrect
            if(item.FailedReason == LogOnFailedReason.IncorrectLogin)
                throw new Exception("Incorrect login");
        }
    }
}

Remarks

OnOverridingExtranetLogOn

public const string OnOverridingExtranetLogOn = "DWN_STANDARD_USER_OnOverridingExtranetLogOn"

Field Value

string
To top