Facebook Canvas POST ASP.net
Facebook 要求所有画布应用程序在 iframe 中支持 HTTP POST,而不是 GET。但是,当我启用该功能时,ASP.net 抱怨
不允许用于访问路径“/”的 HTTP 动词 POST
由于某种原因,Facebook 需要一个没有扩展名的路径(例如,它需要 mydomain.com/random/
而不是 mydomain.com/mypage.aspx
)。
如何为我的 web.config 页面中的 aspx 页面和根(默认)页面启用 POST,以便我可以在本地开发我的应用程序?我相信 IIS 上的配置更简单。
谢谢。
Facebook is requiring all canvas apps to support HTTP POST in the iframe instead of GET. However, when I enable the feature, ASP.net complains that
The HTTP verb POST used to access path '/' is not allowed
For some reason Facebook requires a path that does not have an extension in it (for example it requires mydomain.com/random/
instead of mydomain.com/mypage.aspx
).
How can I enable POST for aspx pages and the root (default) page in my web.config page so I can develop my app locally? I belive the configuration on IIS is more straightforward.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
迷人。直到我尝试之后我才相信。通过添加在 VStudio 的 Web 服务器中运行此程序时,我能够摆脱异常code> 到
部分。诀窍是,它实际上并没有显示默认页面,也没有运行 Page_Load 事件。我将System.Web.UI.Page
替换为默认页面的命名空间和类型,这次运行了 Page_Load 事件,但 .aspx 文件中的标记似乎已被忽略。在 Page_Load 事件中调用 Response.Write() 确实会导致输出到浏览器。所以,也许这本身很有用,或者它可能为您指明了正确的方向。
不过,我也不知道这可能会产生什么副作用,所以请谨慎行事。
编辑:您想要的类型可以在 machine.config 中找到 -
System.Web.UI.PageHandlerFactory
Fascinating. I didn't believe it until I tried it. I was able to get rid of the exception when running this in VStudio's web server by adding
<add verb="*" path="/" type="System.Web.UI.Page"/>
to the<httpHandlers>
section. The trick is, it didn't actually display the default page, or run the Page_Load event. I replacedSystem.Web.UI.Page
with the namespace and type of my default page, and this time the Page_Load event ran, but the markup in the .aspx file seems to have been ignored. A call to Response.Write() in the Page_Load event did result in output to the browser.So, maybe that's useful on its own, or maybe it points you in the right direction.
I also don't really know what side effects this might have, though, so proceed with caution.
Edit: The type you want can be found in the machine.config--
System.Web.UI.PageHandlerFactory
不认为你可以...而不是本地主机,你实际上必须将你的应用程序推送到 FB 服务器可以看到的网络服务器上,然后你的应用程序应该可以工作。
don't think you can... Instead of localhost, you actually have to push your app out to a server on the web that the FB servers can see, then your app should work.
我通过将请求“重写”到 Global.asax 文件中的根路径找到了一个可行的解决方案。适用于开发服务器,但可能必须在生产中删除:
I've found a workable solution by "rewriting" the requests to my root path in the Global.asax file. Works for development server, but will probably have to be removed in production: