Re: HttpWebRequest.GetResponse on POST returns 405 method not allowed

Tech-Archive recommends: Fix windows errors by optimizing your registry




Craig Deelsnyder Wrote:
>
> A server can refuse to accept a POST request for a certain page, only
> a
> GET. Perhaps they can also do so based on referrer, so outside sites
> cannot POST into the site.
>

I can POST to this page normally, the URL specified localhost which
resolved to 127.0.0.1. When I changed it to the actual IP of my
machine, it worked. Not sure why, because I can (and usually do) access
the machine using http://localhost/. Since this is a development server,
I modified the code slightly:


string sServer = Request.ServerVariables["SERVER_NAME"];
string sURL = string.Format(@"http://{0}/PostToMe.html";, sServer);


Craig Deelsnyder Wrote:
>
> Have you verified all of this is not true? Also verify you are
> POSTing
> to the correct URL, and that all fields that are expected by the
> receiving site are included in your form.
>

All of this is correct -- the page doesn't require any variables, and
simply does a dump of all variables it receives -- great for testing!

I have worked around the problem by specifying a server name, but would
love to know why localhost didn't work.

Thanks,
Glenn


--
GlennLanier
------------------------------------------------------------------------
GlennLanier's Profile: http://www.highdots.com/forums/member.php?userid=211
View this thread: http://www.highdots.com/forums/showthread.php?t=1495817

.



Relevant Pages

  • Re: database connection.
    ... >> Maybe have to give the aspnet user access to that directory. ... >>Craig Deelsnyder ... don't remember where Oracle stores those on the server. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: create a pdf file
    ... > create it in memory so i wouldn't have to save it on the server. ... Craig Deelsnyder ... Microsoft MVP - ASP/ASP.NET ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Problem starting with ASP.NET
    ... You said to watch the URL wrap, is this the correct URL: ... What is "hth" that you wrote after the URL? ... >> The server does not support debugging of ASP.NET or ATL Server ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Its simple code but I got 400 URL must be absolute and it says its a Internal response
    ... > But there is one more strange. ... Is it Zeus server problem? ... Since you haven't told us the correct URL, ... Sinan Unur ...
    (comp.lang.perl.misc)
  • Re: Blank Console for Trend c/s/m SMB
    ... I traced the shortcut from the start menu to the link ... server name, I had the same problem mentioned until I did ... >directly in the browser address. ... >menu to the correct URL. ...
    (microsoft.public.windows.server.sbs)