Facebook共享功能在评论框中显示不完整的数据

时间:2014-07-15 06:36:27

标签: asp.net facebook share

我想在Facebook上发布一个链接,但是当点击分享按钮时显示错误的数据,但同样的事情在Twitter分享中工作正常。

以下是推特工作正常的代码:

private void btnTweetShare_Click(object sender, RoutedEventArgs e)
{
HtmlPage.Window.Navigate(new Uri(string.Format("http://twitter.com/share?url={0}",    HttpUtility.UrlEncode(URLTextBox.Text))), "_blank");
}

以下是twitter分享的图片: enter image description here

我想在Facebook上分享相同的数据,我的代码也相同,但是它会发布无效数据。 我将数据作为QueryString传递给Url for twitter和facebook。

private void btnFBShare_Click(object sender, RoutedEventArgs e)
    {
        HtmlPage.Window.Navigate(new Uri(string.Format("http://www.facebook.com/sharer.php?u={0}", HttpUtility.UrlEncode(URLTextBox.Text))), "_blank");
    }

在图片下方,您可以看到Facebook分享评论框包含不完整的数据,这是我要发布的链接。 enter image description here

你可以看到,我想要复制完整的链接,但它只复制了它的一部分。 即, 而不是从查询字符串显示完整的值 enter image description here 它只显示其中的一部分,即 localhost

非常感谢任何形式的帮助。 感谢

1 个答案:

答案 0 :(得分:1)

您无法与localhost共享内容,请查看localhost是什么:http://en.wikipedia.org/wiki/Localhost

如果您想与sharer.php共享内容,则必须是每个人都可以使用的URL。真正的公共服务器,具有真实域。

另外,sharer.php从共享网址中获取Open Graph标记,更多相关内容:http://ogp.me/