Error 405??

Aug 1, 2007 at 7:24 PM
I keep getting erros when trying to set up an FBML app.

Errors while loading page from application
Received HTTP error code 405 while loading http://*************

There are still a few kinks Facebook and the makers of ***** are trying to iron out. We appreciate your patience as we try to fix these issues. Your problem has been logged - if it persists, please come back in a few days. Thanks!

I can access the http://************** fine using my own browser or a different computer/network. Which if I view source only contains the fb redirect for login which seems right.

My understanding is that 405 is a bad method or something? Anyone else have this problem and or know a solution?
Aug 2, 2007 at 4:44 AM
Anyone else ever have a problem like this before? I could really use some help on this to get this fixed. I am falling way behind a dead line to try to get this one app up and running. Am I missing a header? I tried setting the response.statuscode to 200 but that did not fix anything on it.

Any help is much appreciated!

Thanks!
Aug 2, 2007 at 6:20 PM
I found the cause of my problem I believe. If I add default.aspx to the callback page then it will work. As for some reason if I just specify the folder it will not load default.aspx even though that is the only default document in IIS. Unfortunately this causes the url forwards to not work on links as it tries to append the linked page to default.aspx so that it would look something like

apps.facebook.com/myapp/default.aspxsearch.aspx

Anyone ever have this issue of the default.aspx page not loading with out being explicity names and having an Error 405 thrown?

Aug 5, 2007 at 9:37 PM
It's a bug in IIS 4 and IIS5. You cannot POST to a url ending in /, even if the default document is dynamic. It is fixed in IIS 6. I'd suggest upgrading

http://support.microsoft.com/kb/216493

Hope that helps
Jon
Aug 6, 2007 at 5:01 PM
THANK YOU JON!!!
Nov 6, 2007 at 11:34 PM
I seem to have the same type of error when I submit a form:

Received HTTP error code 404 while loading http://MYSERVERIP/MY_DIR/Default.aspxDefault.aspx

It happens no matter what I put in the "action" of the form (leave it blank, "Default.apsx", full URL...)
Worse is that I'm running IIS 6.0 on Windows Server 2003 Enterprise Edition, so it should take the directory in the Callback URL setting on Facebook
In the Callback URL, I had to put http://MYSERVERIP/MYDIR/Default.aspx, otherwise it wouldn't work with http://MYSERVERIP/MYDIR/

In Default.aspx I have something like:

<form id="form1" action="" runat="server">
<asp:TextBox ID="MyInput" runat="server"></asp:TextBox>
<input type="submit" value="default submit" onclick="MyFunc" />

In Default.aspx.cs:

public void MyFunc()
{
lblHelloWorld.Text = "I wrote: " + MyInput.Text;
}

Any pointer appreciated :-)
Nov 7, 2007 at 1:18 AM
I ran into this same problem. Here's how I fixed it:

1. Set your Callback Url to the root directory where your app is stored. e.g.
http://someserver.com/myappdir/

2. Set your Side Nav URL to an actual page you can land on, such as:
http://someserver.com/myappdir/default.aspx

That seems to do it for me. You can also set your Post Add URL to some actual page (welcome.aspx? default.aspx? whatever makes sense for your app). When you hit the left nav button, it will load the Side Nav URL, which works. When you click on a form, it won't append the extra Default.aspx and that works too. Give that a shot.

Mar 17, 2008 at 9:34 PM
I'm running IIS 5 on a Windows 2000 box. I was able to fix this problem by converting default.aspx so that is redirected to a different file, which became my application's new home page. I saw this suggested in the MS KB article, and I didn't think it would work, but it's holding up so far. I was able to keep the Callback URL and Side Nav URL in the format of http://someserver.com/myappdir/, so the rest of the relative links in my application didn't break.
Apr 24, 2008 at 10:41 PM
This is definitely something new that seems to be caused by FB and their HTTP postback. I had a few DEV copies of my apps running on my test box and all of a sudden I started getting this error on all of them, as well as one I was setting up to go live. The adding of the file name the the left side nav url for one of them resolved it but I still cannot get any of my DEV copies working.
Apr 25, 2008 at 12:52 AM
Actually, I think I had some other issues - still don't have it resolved, but...

I am a ColdFusion user, and I recently installed the IIS resource kit, and I think it changed the mappings in my web sites. But even after I configured my file extensions to pint to the DLL, it still does not work. Found this link in case it helps anyone else.
http://www.somacon.com/p126.php

Dan
Nov 17, 2008 at 4:14 PM
Edited Nov 17, 2008 at 10:33 PM
I thought I'd share my solution to the Error 405 problem.  The basic premise of the problem is that IIS 5 doesn't allow post requests unless an aspx page is requested.  The second premise is that if you set your callback url to http://www.mysite.com/default.aspx, subsequent pages will go to http://www.mysite.com/default.aspxHome.aspx.

The solution I am using is to set my callback url to http://www.mysite.com/default.aspx/. 

I added the following code to my global.asax file:

    protected void Application_BeginRequest(object sender, EventArgs e)
    {
        RewriteURL();
    }

    void RewriteURL()
    {
    
        string CurrentPath = Request.Path.ToLower();
        if (CurrentPath.LastIndexOf("/") == CurrentPath.Length - 1)
        {
            HttpContext.Current.RewritePath("/default.aspx");
        }
        else
        {
            HttpContext.Current.RewritePath(CurrentPath.Replace("/default.aspx/", "/"));
        }
    }

I agree that it's quite ugly.  If you have a better suggestion (besides using IIS 6), I'm all ears!


Nov 19, 2008 at 10:53 PM
Edited Nov 19, 2008 at 11:02 PM
Thanks Timble