Adding Google Friend Connect to Blogengine.net Blog

Today i am shifting my blog from BlogSpot to custom domain, so i will be doing a series of post in all the hassles i have to face during this exercise and share my experience with you, so that any one else in plans of shifting the blog to custom domain and also the blog code being open source, should not face the same problems as i am facing. Smallworkarounds was known for its unique look and feel and various plugins customized in the heart of Google’s blogger.Still the new blog is not even close to the look and feel of the current BlogSpot version but its OK for now i will be rewriting the whole code myself within few days as i get time from my busy schedule. I will be writing mostly on how to transfer each module you see on Smallworkarounds on blogspot to www.smallworkarounds.com. For today i will be discussing how to integrate Google’s Friend Connect into BlogEngine.net. First of all let me tell you why i chose blogengine.net, the obvious reason is that i have already worked on blogengine.net and i am familier with most of its code and I can do tweaks to it’s code in no time. Secondly what i found after googling was that blogengine.net is the leader in the open source blog engines built in .net. Although there are few other competitors but again all comes to personal choice you can use anyone of the other products out there. I faced few issues with blogengine.net on Godaddy but i will be dealing those issues in the upcoming posts. So let’s begin the journey from what i am currently doing and leave the  rest for future. Currently i have all my posts imported from blogger to blogengine.net  with some minor errors which i am tweaking daily. In my blogspot blog i was having a Google Friend Connect toolbar which used to pop up at the bottom, but now the question is how to get the same popup bar with same followers in your blogengine.net blog with your custom domain. Googling a bit lead me to this post by Mayank Raichura , he has done all the hard work but what he has implemented is a little different from what i wanted. You can download his sample from here Hi implementation lets you to have google friend connect only inside the posts pages not on all the pages as this is clear from his code i modified his code a bit and everything then worked just fine for me.

 public void CreateFriendConnectBar(ServingEventArgs e)
    {
        settings = ExtensionManager.GetSettings(GetType().Name);

        //Settings should be retrieved after this...
        string sb_Site_ID = settings.GetSingleValue("Site_ID").ToLower();
        string sb_Div_Tag_ID = settings.GetSingleValue("Div_Tag_ID").ToLower();
        string sb_Scope_of_Social_Bar = "SITE";        
        bool sb_Allow_Anonymous_Post = bool.Parse(settings.GetSingleValue("Allow_Anonymous_Post").ToLower());

        //End Settings Retrieval
        e.Body += "n<!-- Google_Friend_Connects_Social_Bar extension by Mayank Raichura -->n";
        e.Body += BuildHTML(sb_Site_ID, sb_Div_Tag_ID, sb_Scope_of_Social_Bar, sb_Allow_Anonymous_Post);
    }
    private void Post_Serving(object sender, ServingEventArgs e)
    {
        post = (Post)sender;
        CreateFriendConnectBar(e);
    }

I removed his code where he is checking whether it is a post page or stuffs related to posts which he is checking in his first few lines and created a method called CreateFriendConnectBar(ServingEventArgs e) which i call from the Post_Serving event basically i am not checking that is the post null or something else, this will run in every case.

The important thing which you have to do other then what is stated is instead of this line

string sb_Scope_of_Social_Bar = "PAGE";

 

just replace “PAGE” with “SITE”, then just follow the instruction given on his blog to complete the steps.

string sb_Scope_of_Social_Bar = "SITE";

 

One more thing which most of you will forget is that consider a situation wherein from your previous blogspot blog your were having 2000 followers then you definitely would not want to lose your followers by just going and creating a absolutely new account for the new domain hosting.

So the solution for this is just go to your Google Friend Connect account and remap the url or site url field to your new website on the custom domain.

 

 

 

Also as a quick tip make sure your are having rpc_relay  and canvas files in your website root folder.