Monday, 6 April 2009

Integrating Instant MSN messenger in ASP.NET

Though this feature may be available in MS sharepoint portals but some time we need to embed MSN windows(not live messenger) Messenger in our own non portal website .Before starting our mission, we need RCW(Runtime callable Wrapper) interfaces for messenger so .Net Environment can understand old Com's Methods and properties.
Note:You also need to know about STA and MTA Thread pool.
  • Open Menu->Type "C:\Program Files\Messenger" in Run.
  • msmsgs.exe is our target to convert it to .Net assembly.
We will use TLBImp.exe tool that will import metadata from msmsgs type library and convert it to .Net assembly where Metadata will be stored in assembly manifest.All Methods and properties from Com components will be exposed through new generated dll. However it is nessary that old COMs should be existed and should be registered in registry before Generating RCW wrapper(.Net dll).

  • Goto MS visual studio 2005 tools->open Visula studio 2005 Command prompt.
  • type following command
C:\Program Files\Microsoft Visual Studio 8\VC>tlbimp.exe "C:\Program Files\Messe nger\msmsgs.exe" /out:C:\inetpub\wwwroot\myWebsitedirectory\inetpubdotnetmsgr.dll
  • On Solution Explorer in VS 2005 , right click and Add Reference
Select Converted Dll from Add refernence window.

Now Switch to code view and this code.

Normal 0 false false false MicrosoftInternetExplorer4

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using inetpubdotnetmsgr;

public partial class Messenger : System.Web.UI.Page


protected void Page_Load(object sender, EventArgs e)


if (IsPostBack==false)


MsgrObjectClass _messngerobject = new MsgrObjectClass();


//IMsgrService _ImessngerService = _messngerobject.IMsgrObject_Services.PrimaryService;

_messngerobject.Logon("", "mypassword", _messngerobject.Services.PrimaryService);

IMsgrUsers _Users = _messngerobject.get_List(MLIST.MLIST_CONTACT);

foreach (IMsgrUser _user in _Users)







You aslo need to set permission on new generated Dll for User.


  1. Does it work for other messengers too????........My office have their own messenger......I am working over a project on it.........

  2. Hi

    Is it possible to integrate msn video conference with my page using this method ????


  3. @r4revolution , you can implement this method for every unmanaged dll developed outside .net have take care of MTA and STA thread pool as is Mulitthreaded.

    @Testing no you should not use this methid for msn video conference.

  4. Hi Zanab

    Could you please tell me how can I integrate msn video conference in my web page