server error:405 - HTTP verb used to access this page is not allowed
Asked Answered
T

10

38

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.

Thousandth answered 27/7, 2011 at 7:56 Comment(1)
For those reading, if the "Requested URL" is a *.json file, follow these instructions: 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.Grannias
P
65

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 :)

Prud answered 13/10, 2011 at 17:30 Comment(5)
How about configuring the server to allow the page?Imperialism
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?Soakage
the controller should be handling the post event, u need to do something like this : [HttpPost] public ActionResult Index() { }Prud
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.Tallyho
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)Mattias
F
13

you can add these lines to the web.config:

<system.webServer>
  <modules>
    <remove name="WebDAVModule" />
  </modules>
  <handlers>
    <remove name="WebDAV" />
  </handlers>
</system.webServer>
Fiasco answered 5/12, 2021 at 17:43 Comment(3)
I was calling DELETE verb for an API and I was facing the exact problem. Adding these to my web.config solved the problem.Dumbfound
Thanks, I was having an issue using PUT on an old Windows2012R2 box and this saved me.Heidy
This worked for me using a PUT on a 2012R" box too! Thanks @Heidy for mentioning the server versionYorick
A
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/

Arrowworm answered 21/5, 2012 at 4:52 Comment(0)
S
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.

Sandstrom answered 27/7, 2011 at 8:7 Comment(4)
How can I make the server allow the POST verb ?Thousandth
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?Sandstrom
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.Thousandth
Then its a problem with your webserver configuration (iis ? ). Have a go at this guide somacon.com/p126.php if that dosent work then post a question on server faultSandstrom
G
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>
Gradatim answered 8/1, 2015 at 3:34 Comment(0)
J
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).

Jonquil answered 4/9, 2012 at 10:2 Comment(0)
K
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.

Kathiekathleen answered 3/10, 2014 at 19:35 Comment(0)
C
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).

Collectivity answered 23/11, 2020 at 0:50 Comment(0)
K
0

I got this error when I was using jquery and lib was not present in the given path, once jquery lib is added back error was gone. [File name - calculate.html]

Knothole answered 2/9, 2021 at 5:9 Comment(0)
C
-1

I had this err on the host too (my project was .net core2.1 webapi ) please add this code in web config in host :

<modules>
         <remove name="WebDAVModule" />
</modules>
Contemporaneous answered 27/7, 2011 at 7:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.