Printer Friendly Version      Send     
Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Windows Live
 MessengerChat Control
Windows Live
MessengerChat Control

This topic describes the parameters and default values created when you add the MessengerChat control to enable Windows Live™ Messenger access on a Web page.

<live:MessengerChat 
      ID="id" > 
</live:MessengerChat>

The parameters shown in the syntax section and in the beginning of the parameters table are the parameters created when dragging the control from the Toolbox and dropping it on a Web page. The default values in the description are also those created when dragging the control from the Toolbox and dropping it on a Web page.

Parameter Description

ID

Required. The unique identifier for the control on the Web page. The default value is MessengerChat1.

PrivacyStatementURL

Required. A URL to the Web site privacy statement. Set this parameter to ~/privacyPolicy.htm (and create the file if it does not already exist) if you plan to use other Windows Live controls.

CID

Optional. The Messenger chat ID.

ColorTheme-Name

Optional. The color theme for the control on the Web page. The valid values are:

BlueCustomDefaultGrayGreenOrangePurpleRed

The default value is Default. If this value is Custom, you can set the parameters that start with ColorTheme-, which are listed at the end of this table.

SignUpLinkText

Optional. The message that is displayed to the user to sign up for Windows Live Messenger. The default value is "Signup for Windows Live Messenger on this site!"

View

Optional. This represents the different views that the control can present. Valid values are:

Button means the control is presented as a button, with the icon in the center.

Icon means the control is presented solely as the icon.

Window means the control is presented as a window.

The default value is Window.

ColorTheme-foreColor

Optional. The color of the text.

Note:
The text string "8 characters" is always gray.

ColorTheme-backColor

Optional. The color of the background.

ColorTheme-linkColor

Optional. The color of the hyperlinks.

ColorTheme-borderColor

Optional. The color of the border.

ColorTheme-buttonForeColor

Optional. The color of the text for active buttons.

ColorTheme-buttonBackColor

Optional. The color of the background for active buttons.

ColorTheme-buttonBorderColor

Optional. The color of the border for buttons.

ColorTheme-buttonDisabledColor

Optional. The color of the background for a disabled button.

ColorTheme-headerForeColor

Optional. The color of the text for the header area.

ColorTheme-headerBackColor

Optional. The color of the background for the header area.

ColorTheme-menuForeColor

Optional. The color of the text for menus.

ColorTheme-menuBackColor

Optional. The color of the background for menus.

ColorTheme-chatForeColor

Optional. The color of the text for the text and typing area.

ColorTheme-chatBackColor

Optional. The color of the background for the text and typing area.

ColorTheme-chatDisabledColor

Optional. The color of the background for the text and typing area when the user's status is Offline.

ColorTheme-chatErrorColor

Optional. The color of the text for error messages in the text area.

ColorTheme-chatLabelColor

Optional. The color of the text for the IM Label, such as "Display Name".

The MessengerChat control can raise the following server event.

Event Description

OnMessengerChatSignup

Raised when the user signs into Windows Messenger.

OnMessengerChatSignup Event

Raised when the user signs into Windows Messenger.

C# Syntax

using Microsoft.Live.ServerControls;
…
protected void OnMessengerChatSignupHandler(object sender, MessengerChatSignupEventArgs e)

Parameters

Parameter Description

sender

The MessengerChat object.

e

The MessengerChatSignupEventArgs object.

The MessengerChat control has the following methods that you can use to control access to Messenger on a Web site.

Method Description

GetUserAssociation

Gets the Messenger Chat ID associated with an ASP.NET client ID.

RemoveUserAssociation

Removes the association between the user and the current Messenger Chat ID

SetUser

Associates the current Messenger Chat ID with an authenticated ASP.NET client ID.

SetUserAssociation

Associates a Messenger Chat ID with an ASP.NET client ID.

GetUserAssociation Method

Gets the Messenger Chat ID associated with an ASP.NET client ID.

Syntax

String CID = MessengerChatControl.GetUserAssociation(userID);

Parameters

Parameter Description

userID

The ASP.NET client ID.

Example

The following example gets the Messenger Chat ID associated with the current ASP.NET user, if the user has been authenticated (that is, has logged in).

if (Page.User.Identity.IsAuthenticated)
{
   string cid = Messengerchat1.GetUserAssociation(Page.User.Identity.Name);
}

RemoveUserAssociation Method

Removes the association between the user and the current Messenger Chat ID.

Syntax

Void MessengerchatControl.RemoveUserAssociation(userID);

Parameters

Parameter Description

userID

The ASP.NET client ID.

Example

The following example removes the association between the current ASP.NET user, if the user has been authenticated (that is, has logged in), and current Messenger Chat ID.

if (Page.User.Identity.IsAuthenticated)
{
   Messengerchat1.RemoveUserAssociation(Page.User.Identity.Name);
}

SetUser Method

Associates the current Messenger Chat ID with an authenticated ASP.NET client ID.

Syntax

Void MessengerchatControl.SetUser(userID);

Parameters

Parameter Description

userID

The ASP.NET client ID.

Example

The following example associates the Messenger Chat ID associated with the current ASP.NET user, if the user has been authenticated (that is, has logged in).

if (Page.User.Identity.IsAuthenticated)
{
   Messengerchat1.SetUser(Page.User.Identity.Name);
}

SetUserAssociation Method

Associates a Messenger Chat ID with an ASP.NET client ID.

Syntax

Void MessengerchatControl.SetUserAssociation(userID, CID);

Parameters

Parameter Description

userID

The ASP.NET client ID.

CID

The Messenger Chat ID.

Example

The following example uses the OnMessengerChatSignup event to associate the current ASP.NET user, if the user has been authenticated (that is, has logged in), with the newly logged in Messenger Chat ID.

protected void OnMessengerChatSignup(object sender, MessengerChatSignupEventArgs e)
{
   if (Page.User.Identity.IsAuthenticated)
   {
      Messengerchat1.SetUserAssociation(Page.User.Identity.Name, e.CID);
   }
}
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker