You must Sign In to post a response.
  • Category: ASP.Net MVC

    I got a requirement that is sharing article on facebook

    Hii All,
    i want to share my article on Facebook, i am using Mvc
    i have done this task , but getting issue by default some content from bottom menu is showing in dialog share window for every article
    suggest me how to fix this one
  • #764541
    You can use given code snippet in your program to share your articles of Facebook by using Mvc

    using System.Web.UI.HtmlControls;
    protected void Page_Load(object sender, EventArgs e)
    lblShare.Text = "<a name=\"fb_share\" type=\"button\"></a>" +
    "<script " +
    "src=\"\" " +
    HtmlMeta tag = new HtmlMeta();
    tag.Name = "title";
    tag.Content = "This is the page title";
    HtmlMeta tag1 = new HtmlMeta();
    tag.Name = "description";
    tag.Content = "This is a page description.";

    More details at given URL

  • #764547
    without looking at your code it is difficult to manage the things, can you post your code so that we can help you better.
    As far as I know it is very easy to share something on facebook, just you need to pass your url as a query string named u and facebook render that url content data and link for sharing.
    see below sample
    <a href=" path of your html file" title="share on facebook">Click to share on facebook</a>
    or you can switch to below link for more information

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #764578
    i used below code for Sharing
    var fburl = "";
    strpostinfo = strpostinfo + '<a class="btn btn-primary btn-xs" href=' + totUrl + ' onclick="return fbs_click(600, 600)" target="_blank" title=""><i class="fa fa-facebook"></i>Share</a>';
    strpostinfo = strpostinfo + '</div></div>';
    //End for Share Info into Socialsites
    function fbs_click(width, height) {

    var leftPosition, topPosition;
    leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
    topPosition = (window.screen.height / 2) - ((height / 2) + 50);
    var windowFeatures = "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no";
    // u = location.href;
    t = document.title;
    u = '';'' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', windowFeatures);
    return false;

Sign In to post your comments