32

I have a php Facebook application which I have uploaded in a Microsoft server. When I run the application i get this error. Does anybody know the cause of this ?

405 - HTTP verb used to access this page is not allowed. The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.

Florian Shena
  • 1,264
  • 4
  • 18
  • 26
  • For those reading, if the "Requested URL" is a *.json file, follow these instructions: http://www.uipress.com/add-json-handler-support-in-iis-7/#.UT_bw9aOR8E ... don't click on the site, click on the server node (in the tree)... that way all sites inherit the setting. – MacGyver Mar 13 '13 at 02:12

7 Answers7

63

Even if you are using IIS or apache, in my guess you are using static html page as a landing page, and by default the web server doesn't allow POST or GET verb on .html page, facebook calls your page via POST/GET verb

the solution would be to rename the page into .php or .aspx and you should be good to go :)

shridutt kothari
  • 7,495
  • 2
  • 41
  • 59
Rabih harb
  • 1,352
  • 12
  • 11
  • How about configuring the server to allow the page? – JNF Apr 03 '13 at 10:05
  • 2
    is not that easy in some cases. For example, I'm using .net mvc. My landing page is a cshtml but I can't just change the name because my controller calls that specific cshtml :( What can I do in such a case? – Moisés Briseño Estrello Jul 04 '13 at 15:53
  • the controller should be handling the post event, u need to do something like this : [HttpPost] public ActionResult Index() { } – Rabih harb Oct 30 '13 at 10:58
  • This didn't work for me. I tried .php and it gave the same result. When I tried .aspx I got the 403 forbidden error. – glln Dec 19 '13 at 11:06
  • 1
    This fixed it from me. There was an old & unused index.html page in the folder that I had been publishing too. I cleared out all unnecessary files (including the index.html) and it began working (went to Default.aspx) – Francis Dean Nov 16 '18 at 14:09
3

In the Facebook app control panel make sure you have a forward slash on the end of any specified URL if you are only specifying a folder name

i.e.

Page Tab URL: http://mypagetabserver.com/custom_tab/

1

I fixed mine by adding these lines on my IIS webconfig.

<httpErrors>
    <remove statusCode="405" subStatusCode="-1" />
    <error statusCode="405" prefixLanguageFilePath="" path="/my-page.htm" responseMode="ExecuteURL" />
</httpErrors>
Wreeecks
  • 1,818
  • 23
  • 44
1

It means litraly that, your trying to use the wrong http verb when accessing some http content. A lot of content on webservices you need to use a POST to consume. I suspect your trying to access the facebook API using the wrong http verb.

Tom Squires
  • 8,106
  • 9
  • 44
  • 68
  • How can I make the server allow the POST verb ? – Florian Shena Jul 27 '11 at 08:13
  • So your application is throwing the error directly, not when you call the webservice? When you comment out that part that calls facebook does it still error? Perhaps you could show us some code? – Tom Squires Jul 27 '11 at 08:23
  • Actually it also shows me the same error even when I just load an html page in a facebook app, without trying to load the FB API. – Florian Shena Jul 27 '11 at 08:28
  • Then its a problem with your webserver configuration (iis ? ). Have a go at this guide http://www.somacon.com/p126.php if that dosent work then post a question on server fault – Tom Squires Jul 27 '11 at 08:37
0

I've been pulling my hair out over this one for a couple of hours also. fakeartist appears correct though - I changed the file extension from .htm to .php and I can now see my page in Facebook! It also works if you change the extension to .aspx - perhaps it just needs to be a server side extension (I've not tried with .jsp).

0

Try renaming the default file. In my case, a recent move to IIS7.5 gave the 405 error. I changed index.aspx to default.aspx and it worked immediately for me.

0

In my case, IIS was fine but.. uh.. all the files in the folder except web.config had been deleted (a manual deployment half-done on a test site).

SteveCav
  • 6,231
  • 42
  • 51