More in this section

Forums / Developing with Sitefinity / Overriding SocialBookmarks controls

Overriding SocialBookmarks controls

2 posts, 0 answered
  1. Duncan Evans
    Duncan Evans avatar
    122 posts
    Registered:
    07 Jul 2009
    18 Sep 2009
    Link to this post
    i need to override the SocialBookmarks control for blogs and images modules so that i can add/utilize the following code (to make the post URLS to these social sites "tiny")

        private string MakeTinyURL(string url) 
        { 
            try 
            { 
                if (url.Length <= 30) 
                { 
                    return url; 
                } 
                if (!url.ToLower().StartsWith("http") && !url.ToLower().StartsWith("ftp")) 
                { 
                    url = "http://" + url; 
                } 
                var request = WebRequest.Create("http://tinyurl.com/api-create.php?url=" + url); 
                var res = request.GetResponse(); 
                string text; 
                using (var reader = new StreamReader(res.GetResponseStream())) 
                { 
                    text = reader.ReadToEnd(); 
                } 
                return text; 
            } 
            catch (Exception) 
            { 
                return url; 
            } 
        } 

    Could someone show me how to override these controls to add this functionality?

    Duncan
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 Sep 2009
    Link to this post
    Hi Duncan Evans,

    SocialBookmark is an internal class under ContentView class and cannot be overridden. The same applies for RenderBookmark. We will try to optimize the methods for the next releases.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered