Facebook 评论框无法通过 URL 重写正常工作?
我很想在我的网页中使用 Facebook 评论插件,但它确实如此无法与 UrlRewriting.net 正常工作。
我在网页中添加了评论代码(动态生成并使用 URL 重写),并注意到评论(应仅存在于特定页面)对于具有相同重写规则的所有网页都是可见的。
更新:重写规则是
<add name="Rule1" virtualUrl="^~/temp/(.*)/(.*).aspx"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/Directory/page.aspx?ItemID=$1&id=$2&lng=gr"/>
I would love to use the Facebook comment plugin in my webpage, but it does not work correctly with UrlRewriting.net.
I added the comments code in my webpage (that is generated dynamically and uses Url-Rewriting) and noticed that the comment (that should exist only to the specific page) is visible-available to all the webpages that have the same rewrite rule.
UPDATE: The Rewrite rule is
<add name="Rule1" virtualUrl="^~/temp/(.*)/(.*).aspx"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/Directory/page.aspx?ItemID=$1&id=$2&lng=gr"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要正确使用 Facebook 社交插件,您只需为每个页面提供一个唯一的字符串即可。
话虽如此,URL 不是强制性的。例如,如果每个页面都有一个唯一的数字/字母数字/任何 ID,则只需使用
href
即可,无需使用
href="http://mysitename.com/无论页面/etc/etc/etc/"
。在我看来,这样做实际上更好,因为如果您想动态转储 URL,则实际 URL 可能会在您不知情的情况下发生更改,例如。
http://example.com/pages/about-us
与http://example.com/pages/about-us?comment 是不同的 URL =43&page=4
,因此,将具有与 facebook 不同的评论源。 (又名href="pages/about-us"
的评论不会与href="pages/about-us?comment=43&page=4"
的评论相关代码>)To use correctly that facebook social plugin, you simply need to provide a unique string for each of your pages.
That being said, the URL is not mandatory. If, for example, you have an unique numeric/ alphanumeric/ whatever ID for each page, you could simply have the
href
no need to have
href="http://mysitename.com/whateverpage/etc/etc/etc/"
.In my opinion it's actually better to do it like that because if you're tempted to just dump the URL dynamically, the actual URL might change without your notice, eg.
http://example.com/pages/about-us
is A DIFFERENT URL fromhttp://example.com/pages/about-us?comment=43&page=4
and, in consequence, shall have a different Comment Feed from facebook. ( aka comments wherehref="pages/about-us"
won't be related to comments wherehref="pages/about-us?comment=43&page=4"
)您的页面 URL 必须有一个查询字符串,使 URL 唯一
编辑
您可以通过使您的 URL 类似于
Your page URL must have a query string that make the URL unique
EDIT
You can pass make your URL something like