Implement FaceBook’s Meta Propertys Into ASP.NET Page

In Page Load event:

 

        // Support for FaceBook Social Meta Graph
        HtmlMeta meta = new HtmlMeta();        
        meta.Attributes.Add("property", "og:title");
        meta.Attributes.Add("content", "Title here");
        Page.Header.Controls.Add(meta);

        meta = new HtmlMeta();  
        meta.Attributes.Add("property", "og:description");
        meta.Attributes.Add("content", "This is the longer description");
        Page.Header.Controls.Add(meta);
        
        meta = new HtmlMeta();  
        meta.Attributes.Add("property", "og:image");
        meta.Attributes.Add("content", "http://www.yourdomain.com/path/to/thumb_image.jpg");
        Page.Header.Controls.Add(meta);      
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s