Online Presence Webpart

You may have noticed that over the past few weeks I have been trying to build more interactive elements into this blog, some of these include.

  • Most viewed posts webpart.
  • Rate a post.
  • Highest Rated posts webpart.
  • Concurrent user indicator.
  • MSN client, online / offline status.
  • Sessions per hour graph.

My intention was that this blog would start to expose more of the interesting content and create a slight online presence awareness by subtly reacting to how it is interacted with.

Most of the features I just listed are part of a Sqlite stats database that I’ve been logging certain sessions/hits/ratings to. I hope to make this available in the near future with a slightly improved version of the Sqlite datalayer.

But for now here is how to install the code I am using to control the MSN client and a preview of the Concurrent user indicator.

How to install this webpart.

Step 1: Create yourself a new ‘bot’ msn account that your website will use, than add yourself to the bot’s contact list.

Step 2: Add these 2 events to your Global.asax file

protected void Session_OnStart()
{
kowitz.SingleUserBlog.Services.OnlineUsers RecordUser(Session.SessionID);
kowitz.WebsiteMSN.MSNInstance.SignOn();
}

protectedvoid Session_OnEnd()
{
kowitz.SingleUserBlog.Services. OnlineUsers.DeleteUser(Session.SessionID);
if (kowitz.SingleUserBlog.Services.SqliteBlogStatRecorder.ConcurrentUsers() <= 0)
{
kowitz.WebsiteMSN.MSNInstance SignOff();
}
}

Step 3: Copy the webpart control into the Webparts folder. Copy the images into your images directory and copy the two dlls (kowitz.WebsiteMSN.dll and XihSolutions.DotMSN.dll) into your Bin directory.

Step 4: Add the webpart to your Masterpage’s catalogue zone.

<uc1:MessengerOnlinePresenceID="MessengerOnlinePresence1"Title="Messenger Online Presence"runat="server"/>

Step 5: Add this to your BlogConfiguration.xml file:

<MyMSNAccount> [email protected] </MyMSNAccount>
<
BotMSNAccount> [email protected]</BotMSNAccount>
<
BotMSNPassword>mybotspassword</BotMSNPassword>

Step 6, Allowing your bot to message you when someone leaves feedback: Add this line to the void CommentForm1_CommentAdded() function (just after the call to "Notifications.NotifyAdministrator(subject, body);") in your Posts.aspx page.
kowitz.WebsiteMSN.MSNInstance.SendMeAMessage(body);

Finally

Your blog should now be logging onto MSN when there is at least 1 active session on your site.

As I mentioned before, a lot more of the things I’ve added are part of the Sqlite stats db / blog datalayer I’ve been making and hopefully I’ll also be releasing this soon.

Download

MessengerOnlinePresence webpart

General .NET Internet SingleUserBlog
Posted by: Brendan Kowitz
Last revised: 21 Sep 2013 12:15PM

Comments

5/27/2006 9:11:28 PM
Soon, SUB will take over the world! Maybe its time to compare SUB to other popular .net packages such as .text or subtext?

:D
5/27/2006 9:15:53 PM
SUB: MSN integration, 1
Others: 0
11/15/2008 12:05:23 PM
> Create yourself a new ‘bot’ msn account that your website will use.

Easiest way is to go and create another hotmail account. Sign-in to msn with this new account and add your regular account. The new hotmail account will be the one the website uses to sign-in.

No new comments are allowed on this post.