locked
HTTP verb POST not allowed RRS feed

  • Question

  • User-1344500247 posted

    I have a web service that worked fine in VS2003 that is not taking the transition to VS2005 well. I've tried creating a "Hello World" test service, and it's not working either. The asmx page comes up fine, but when I click "invoke" I get this:

    The HTTP verb POST used to access path 
    '/Restoration/services/Test.asmx/HelloWorld' 
    is not allowed.
    

    I've added this to web.config

     <webServices>
       <protocols>
          <add name="HttpPost" />
       </protocols>
    </webServices>
    

    ...but it doesn't make any difference. I'm guessing there's something very simple I'm overlooking - any ideas?

    Thanks
    Herb

    Friday, January 13, 2006 12:27 PM

Answers

  • User-1596898176 posted

    Complete Solution is As below for every url rewrite engine

    In you Global.ascx file just copy paste the code below.

     protected void Application_BeginRequest(Object sender, EventArgs e){if(Request.Path.IndexOf(".asmx") != -1) // if the url contains .asmx extention

    {

    SendRequestWithSimpleURL(Context);

    return;}else{

     

    ThunderMain.URLRewriter.
    Rewriter.Process(); // this is my URL rewriter Code. Paste your Code for url rewriting

    }

    }

    private static void SendRequestWithSimpleURL(HttpContext context)

    {

    int asmx = context.Request.Path.IndexOf(".asmx");

    string path = context.Request.Path.Substring(0,asmx + 5);

    string pathInfo = context.Request.Path.Substring(asmx + 5);

    context.RewritePath(path,pathInfo,context.Request.Url.Query);

    }

    Thats All it will work fine. Thank you & dont forget to tag as answer if it helps you.

    HappY Programming

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, February 7, 2009 11:13 AM

All replies

  • User-1344500247 posted

    Found the problem here - our URL rewriting code was making the web service unhappy. Excluded the web services from the URL rewriter and now it works.

    Cheers
    Herb

    Friday, January 13, 2006 4:34 PM
  • User1197611713 posted

    I am still getting this problem while trying to use a .asp page in the application.

     

    The HTTP verb POST used to access path ..... not allowed

    Saturday, January 21, 2006 5:01 PM
  • User-1454252679 posted

    I'm starting to think web services are quite the worse thing in ASP.NET you can get.

    I have added in ISS all extensions "*" with all verbs to go to ASP.NET 2.0 handler  (aspnet_isapi.dll) so that I can use user-based authentication in .NET for all files on the server.

    It works nicely, but messes up web services with this error:

    The HTTP verb POST used to access path '..'   is not allowed.

    what does one thing have to do with another is beyond me

     

    Friday, June 30, 2006 4:35 AM
  • User-903973452 posted

    I have the same problem. Because of URL Rewriting. It cause this problems. I I still want to use my URL writing how to solve it?

    httpException (0x80004005): The HTTP verb POST used to access path \'/undefined\' is not allowed.]\r\n

    System.Web.DefaultHttpHandler.BeginProcessRequest

    (HttpContext context, AsyncCallback callback, Object state) +3325797\r\n

    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

    +3284726\r\n

    System.Web.HttpApplication.ExecuteStep(IExecutionStep step,

    Thursday, July 13, 2006 2:08 AM
  • User-903973452 posted
    Sorry, this problems more related to Microsoft Atlas Bridge

    I have the same problem. Because of URL Rewriting. It cause this problems. I I still want to use my URL writing how to solve it?

    httpException (0x80004005): The HTTP verb POST used to access path \'/undefined\' is not allowed.]\r\n

    System.Web.DefaultHttpHandler.BeginProcessRequest

    (HttpContext context, AsyncCallback callback, Object state) +3325797\r\n

    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

    +3284726\r\n

    System.Web.HttpApplication.ExecuteStep(IExecutionStep step,

    Thursday, July 13, 2006 2:10 AM
  • User-924209929 posted
    I had a similar problem, and got very confused when I received the same error message. In my case, it only appeared when testing in the VS 2005 environment. Apparently the built in web server for VS does not allow running of ASP pages.
    Wednesday, August 2, 2006 4:40 PM
  • User-1555209197 posted

    I had same problem. Having a web service and URL Rewriter in 2.0 is causing that problem. I think is a bug, appliaction should not call Rewriter is it is accesing ASMX.

    So, what I did was:

    In Global.asax.vb there is a function that call Rewriter, here the function:

    Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)

    If Not Request.Path.IndexOf(".asmx") >= 0 Then ' added to eliminate the error

     .....URLRewriter.Rewriter.Process()

    End If

    End Sub

    Wednesday, September 20, 2006 9:43 AM
  • User729417696 posted
    if (Request.Path.IndexOf(".asmx") != -1)
    {
    	HandleAjax(context);
    	return;
    };
    
    private static void HandleAjax(HttpContext context)
    {
    	int dotasmx = context.Request.Path.IndexOf(".asmx");
    	string path = context.Request.Path.Substring(0, dotasmx + 5);
    	string pathInfo = context.Request.Path.Substring(dotasmx + 5);
    	context.RewritePath(path, pathInfo, context.Request.Url.Query);
    }
    
     
    Tuesday, April 24, 2007 5:57 PM
  • User-1329334484 posted

    I am sorry, where should this code be placed? Does it fixed problem with adding .* verb in IIS for URL Rewriting? I have the same error with Ajax Toolkit - Slides control... Please help

    Sunday, June 17, 2007 11:28 PM
  • User-1329334484 posted

    In fact I have disabled URL rewriting, just adding *.ver in ISS is causing this problem. What should I do?

    Sunday, June 17, 2007 11:40 PM
  • User-1329334484 posted

    I have tried your code, but it does not work. where should I put it in BeginRequest?

    I get comiplation error, It says that context is unknown...

    void Application_BeginRequest(Object Sender, EventArgs e)

    {

    if (Request.Path.IndexOf(".asmx") != -1)

    {

    HandleAjax(context);

    return;

    };

    }

     

     

    private static void HandleAjax(HttpContext context)

    {

    int dotasmx = context.Request.Path.IndexOf(".asmx");

    string path = context.Request.Path.Substring(0, dotasmx + 5);

    string pathInfo = context.Request.Path.Substring(dotasmx + 5);

    context.RewritePath(path, pathInfo, context.Request.Url.Query);

    }

    Wednesday, July 4, 2007 3:53 PM
  • User-1329334484 posted

    I am also having problems after wildcard applied in ISS. This time Slides Control from Ajax Toolkit does not work. You will get this Java Script error: HTTP verb POST not allowed

    I wonder maybe I need to do the same code for .axd files, but after I tried the same with .axd files, I get "Sys not defined" and "Type not defined" errors...

    Would you know what correct code is for .axd files?

     

    Wednesday, July 4, 2007 11:18 PM
  • User-2009803259 posted

    Im running my HTML pages and have a link from an aspx page(vb.net) to the html(Dreamweaver designed) and Im getting this error.I don knw if its the server or not.But generally it shouldnt be a problem.Maybe if I was linking the HTML to aspx but in this case I don knw why.

    Thursday, July 19, 2007 8:18 AM
  • User-1564413724 posted

    Has anyone found a solution to this?  I tried using the PostBarkUrl and still get the same error.  

     

    Thursday, July 19, 2007 8:39 AM
  • User1872393171 posted

    Hi,

    I've meet same problem when i've tried to use a linkbutton in aspx page that should redirect to a htm page, and put on linkbutton:

    PostBackUrl="~/coco.htm".

    I've solved my problem by using:

    <a href="coco.htm">

    Coco</a>

     Maybe you find this usefull.

    Tuesday, July 31, 2007 7:17 AM
  • User-1473612467 posted

    I eliminated the problem by removing the mapping of ‘*’ to aspnet_isapi.dll in my IIS settings.

    Saturday, June 21, 2008 10:45 AM
  • User255832318 posted

    I have URL rewriting (UrlRewrite.net) and need to map * to aspnet_isapi.dll

    I found a solution for the asmx issue :

          <add name="ScriptHandlerFactory" path="*.asmx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" />
     

    put this into  

    <system.webServer>
        <handlers>

    tags.

     

    It solved everything for me. URL-RW and WS calls (autocomplete Ajax WS call) are working fine :)

     

    i hope this could help.
     

    Wednesday, October 1, 2008 4:45 AM
  • User907845985 posted

     An alternative I found elsewhere in the forums is to call in javascript PageMethods.set_path('/page.aspx'); with the real virtual path not the url friendly path. This will then work with any url rewriting engine.

    Thursday, December 4, 2008 5:07 PM
  • User1434808498 posted

     Hi,

    Anybody got solution to this. I am having the same problem...

     

    <title>The HTTP verb POST used to access path '/DrankBank/Services/AutoComplete.asmx/GetCompletionListOnWhat' is not allowed.</title><style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } </style>

    The HTTP verb POST used to access path '/../Services/AutoComplete.asmx/GetCompletionListOnWhat' is not allowed.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: The HTTP verb POST used to access path '/../Services/AutoComplete.asmx/GetCompletionListOnWhat' is not allowed.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [HttpException (0x80004005): The HTTP verb POST used to access path '/DrankBank/Services/AutoComplete.asmx/GetCompletionListOnWhat' is not allowed.]
    System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +2867986
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8667994
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
     

    Friday, January 30, 2009 12:38 AM
  • User1434808498 posted

     Hi,

    I am still getting error.

     

    <title>The HTTP verb POST used to access path '/DrankBank/Services/AutoComplete.asmx/GetCompletionListOnWhat' is not allowed.</title><style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }</style>

    The HTTP verb POST used to access path '/DrankBank/Services/AutoComplete.asmx/GetCompletionListOnWhat' is not allowed.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: The HTTP verb POST used to access path '/DrankBank/Services/AutoComplete.asmx/GetCompletionListOnWhat' is not allowed.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [HttpException (0x80004005): The HTTP verb POST used to access path '/DrankBank/Services/AutoComplete.asmx/GetCompletionListOnWhat' is not allowed.]
    System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +2867986
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8667994
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155


    Version Information: Microsoft .NET Framework Version:2.0.50727.3031; ASP.NET Version:2.0.50727.3031
     

    Friday, January 30, 2009 12:43 AM
  • User-1596898176 posted

    Complete Solution is As below for every url rewrite engine

    In you Global.ascx file just copy paste the code below.

     protected void Application_BeginRequest(Object sender, EventArgs e){if(Request.Path.IndexOf(".asmx") != -1) // if the url contains .asmx extention

    {

    SendRequestWithSimpleURL(Context);

    return;}else{

     

    ThunderMain.URLRewriter.
    Rewriter.Process(); // this is my URL rewriter Code. Paste your Code for url rewriting

    }

    }

    private static void SendRequestWithSimpleURL(HttpContext context)

    {

    int asmx = context.Request.Path.IndexOf(".asmx");

    string path = context.Request.Path.Substring(0,asmx + 5);

    string pathInfo = context.Request.Path.Substring(asmx + 5);

    context.RewritePath(path,pathInfo,context.Request.Url.Query);

    }

    Thats All it will work fine. Thank you & dont forget to tag as answer if it helps you.

    HappY Programming

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, February 7, 2009 11:13 AM
  • User1434808498 posted

     Hi,

    Thank you so much.........

    Sunday, February 8, 2009 10:46 PM
  • User-1055639753 posted

    have same prob but one thing strange that happens is

    if i click on some other button first and then click on the button producing this error dnt show error again but......... dnt show the appropriate page

    Saturday, February 21, 2009 6:23 AM
  • User1639034410 posted

    finally i found the solution from above code it self.

    you just need to change you context with HttpContext.Current

    if (Request.Path.IndexOf(".asmx") != -1)
            {
                HandleAjax(HttpContext.Current);
                return;

    I have tried your code, but it does not work. where should I put it in BeginRequest?

    I get comiplation error, It says that context is unknown...

    void Application_BeginRequest(Object Sender, EventArgs e)

    {

    if (Request.Path.IndexOf(".asmx") != -1)

    {

    HandleAjax(context);

    return;

    };

    }



    private static void HandleAjax(HttpContext context)

    {

    int dotasmx = context.Request.Path.IndexOf(".asmx");

    string path = context.Request.Path.Substring(0, dotasmx + 5);

    string pathInfo = context.Request.Path.Substring(dotasmx + 5);

    context.RewritePath(path, pathInfo, context.Request.Url.Query);

    }


            }


    from this my code working perfect...

    may be it helps...

    Thanx for the idea.

    Jinesh

    Tuesday, October 6, 2009 3:03 AM
  • User-1294238734 posted

    Thx, solved another problem I had.

    /Tommy

    Monday, June 3, 2013 9:01 AM