Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Canvas POST ASP.net

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.

like image 214
Max Avatar asked Feb 01 '26 07:02

Max


1 Answers

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 replaced System.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

like image 119
joelt Avatar answered Feb 03 '26 19:02

joelt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!