Tweet it, Like it, Digg it?

Roshan Mehta, 28 October 2010

Social networking has become a huge part of our everyday lives, whether it is to connect with friends, share new ideas, or promote an organization that we are part of.  At Magnetism, we believe that using social networking is a great way to spread the word of Microsoft Dynamics CRM and share tips and tricks for users with varying levels of expertise.

We are currently implementing what is called the “Social Connector” – a toolbar which will appear at the bottom of each page on our website which will allow our audience to share the contents of each page with the world. The toolbar includes some of the more popular social networking websites. These include Facebook, Twitter, Digg, Stumble Upon, and Delicious.

Tweet it, Like it, Digg it?

When a user clicks on any of the social networking icons, they are able to share the current page with a short URL. It also retrieves the title in the browser window and uses this as the message to share. Thankfully, Twitter makes this functionality easier by providing a short URL for you.

For the other social media websites that don’t provide automatic URL shortening, we have used the following code to truncate the page URL by using the Tiny URL service.

string urlToShorten = Request.RawUrl;               

var request = WebRequest.Create("http://tinyurl.com/api-create.php?url=" + urlToShorten);

                var res = request.GetResponse();

                string shortUrl;

                using (var reader = new StreamReader(res.GetResponseStream()))

                {

                    shortUrl = reader.ReadToEnd();

                }

                return shortUrl;

To grab the title from the browser window, we use:

string pageTitle = Page.Header.Title;

See the screenshots below for an example of some of the social media “share” options available.

Tweet it, Like it, Digg it?

 Tweet it, Like it, Digg it?