« Home | Creating Your Own Dev SSL Cert for IIS » | Moving from ASP.NET 1.1 to 2.0 » | Link Drop VI » | Silverlight createFromXaml Bug » | C# command line parser? » | Firefox extension: CookiePie » | Hand-held browser » | Silverlight » | Google Finance » | Link drop V » 

Wednesday, December 05, 2007 

Facebook dev, IIS 5.1, and error 405

In the middle of a Facebook application idea of mine. Using the FacebookToolkit to get something together.

It's pretty interesting how Facebook integrates with 3rd party applications. Short version: User accesses "http://apps.facebook.com/<appplication_name>", Facebooks sends your page a POST (you host it wherever you want); Facebook displays the output of your page. Long story: Basic Application Architecture.

You can configure the location of the page Facebook POSTs to - called the Callback Url. I initially had this set to something like: http://www.mycheaphosting.com/Canvas.aspx. The location the Facebook user accesses, i.e. apps.facebook.com/myapplication/ is called the Canvas Page.

Any relative links within your Callback page will become relative to your Canvas page. For example a link to "blah.aspx", will be treated by the browser as a link to "apps.facebook.com/myapplication/blah.aspx". What does Facebook do with a URL like this? It POSTs to the same 'relative' location on your server. Which in my case would be: http://www.mycheaphosting.com/Canvas.aspxblah.aspx. Yuck!

My first thought was: Okay, I can put the logic into a 'default.aspx', and change the Callback URL to: http://www.mycheaphosting.com/.

Have you ever tried to POST to a default document? Under IIS 5.1 - it actually causes a 405 - 'Resource not allowed' error. The best reference on this I could find was in this comment from David Wang's article HOWTO: POST Resources to IIS:

The ability to POST to a DefaultDocument requires IIS6. Prior IIS versions will return "405 Method not Allowed". That is simply a limitation of the IIS Request Processing Pipeline.

The fix: WebDev.WebServer2 - an alternative to the Cassini web server that comes with VS2005. Unlike Cassini this web server can service external requests.

Labels: ,

Is there a way you can sort this programmatically instead of server upgrade

not that I know of.. you could do your coding on a Sever 2003 box.

For 405 errors in IE7, check out this link..

http://dotnetdreamer.com/2009/03/21/azure-services-method-not-allowed-405/

How recent is the behavior that FB tries a POST to the callback server? I now get these 405 errors using a Java client and GlassFish 3.1 server, as developed according to the tutorial http://netbeans.org/kb/docs/websvc/facebook.html. It worked fine about a year ago. So I'm curious as to whether FB changed something or GF changed something.
As I am the writer who owns this tutorial, I'd appreciate any insight you can give!

fb is a joke anymore

Post a Comment