405 error when posting from Flash / C#. Fine from html form.

405 error when posting from Flash / C#. Fine from html form.

am 26.07.2007 22:53:41 von Lawrence Abrams

I am trying to use flash or even a c# code-behind to post to a aspx
docoument with the link being posted to is like : www.example.com/submit/
and it contains a default documents of default.aspx.

When I do this via C# or flash we get a 405 error. On the other hand if I
just make a simple html form to submit to the aspx document it works fine.

Any suggestions? This works fine on another server that is set up
similarly.

--
Lawrence
Microsoft MVP Windows-Security

Re: 405 error when posting from Flash / C#. Fine from html form.

am 27.07.2007 07:50:02 von David Wang

On Jul 26, 1:53 pm, "Lawrence Abrams"
wrote:
> I am trying to use flash or even a c# code-behind to post to a aspx
> docoument with the link being posted to is like :www.example.com/submit/
> and it contains a default documents of default.aspx.
>
> When I do this via C# or flash we get a 405 error. On the other hand if I
> just make a simple html form to submit to the aspx document it works fine.
>
> Any suggestions? This works fine on another server that is set up
> similarly.
>
> --
> Lawrence
> Microsoft MVP Windows-Security




POST to URL like www.example.com/submit/ (i.e. URL where there is no
resource) is supposed to fail with 405. It has nothing to do with C#,
flash, ASPX, HTML, code-behind, etc. Only thing that matters is the
HTTP verb and the actual URL.

It actually works by accident on IIS6/7. Thus, I assume that the
server that fails this POST is not IIS6 and the server that works is
IIS6. Or you may have an ISAPI Filter rewriting the URL such that what
you submit as the client is not what is executed by the server.

However, I still suggest that you make your code POST against a URL
with a resource.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Re: 405 error when posting from Flash / C#. Fine from html form.

am 27.07.2007 18:20:57 von Lawrence Abrams

"David Wang" wrote in message
news:1185515402.525610.160480@z24g2000prh.googlegroups.com.. .
> It actually works by accident on IIS6/7. Thus, I assume that the
> server that fails this POST is not IIS6 and the server that works is
> IIS6. Or you may have an ISAPI Filter rewriting the URL such that what
> you submit as the client is not what is executed by the server.
>

No ISAPI filter rewriting done and this server is definitely IIS6. Running
on 2003 and created some asp code to print the IIS version. Reports it as
Microsoft-IIS/6.0.

Even when we change it to you the specific file, default.aspx, it still
generates the error. As I said, though, when we use a basic html form, it
works fine. It only seems to be having problems when we use something like:

Does not work:
var lv:LoadVars = new LoadVars();
lv.email = "email@test.com";
lv.load("http://stage.pgpcollegeeducation.com/reminder/", "POST");


Yet This works:
var lv:LoadVars = new LoadVars();
lv.load("http://stage.pgpcollegeeducation.com/reminder/?emai l=email@test.com",
"POST");

--
Lawrence

Re: 405 error when posting from Flash / C#. Fine from html form.

am 27.07.2007 21:45:41 von David Wang

On Jul 27, 9:20 am, "Lawrence Abrams"
wrote:
> "David Wang" wrote in message
>
> news:1185515402.525610.160480@z24g2000prh.googlegroups.com.. .
>
> > It actually works by accident on IIS6/7. Thus, I assume that the
> > server that fails this POST is not IIS6 and the server that works is
> > IIS6. Or you may have an ISAPI Filter rewriting the URL such that what
> > you submit as the client is not what is executed by the server.
>
> No ISAPI filter rewriting done and this server is definitely IIS6. Running
> on 2003 and created some asp code to print the IIS version. Reports it as
> Microsoft-IIS/6.0.
>
> Even when we change it to you the specific file, default.aspx, it still
> generates the error. As I said, though, when we use a basic html form, it
> works fine. It only seems to be having problems when we use something like:
>
> Does not work:
> var lv:LoadVars = new LoadVars();
> lv.email = "em...@test.com";
> lv.load("http://stage.pgpcollegeeducation.com/reminder/", "POST");
>
> Yet This works:
> var lv:LoadVars = new LoadVars();
> lv.load("http://stage.pgpcollegeeducation.com/reminder/?emai l=em...@test.com",
> "POST");
>
> --
> Lawrence



Then, I do not believe your issue has anything to do with IIS nor any
IIS-related setting. I believe your issue is related to some ASP.Net
configuration that prevents arbitrary usage of postback functionality.

This is supported by your evidence:
1. 405 happening for /default.aspx, which is definitely not an IIS
behavior. IIS has already delivered the request to ASP.Net, but it
chose to send a 405
2. Not happening when POSTing with .htm - IIS definitely does not
discriminate on how you send the POST

IIS6 will route the POST /reminder/ request to the Default Document
handler, but it sounds like the Default Document handler (ASP.Net in
your case) doesn't send back a 405 for its own reason? Why it sends a
405 -- I do not know -- that is ASP.Net specific behavior.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//