is the PUT requested enabled? RRS feed

  • Question

  • User1697794668 posted

    Hi there,

    When  I use a PUT request, the following is shown.
    Does it mean that put request is enabled and how can I disable it?

    <HTML><HEAD><TITLE>Length Required</TITLE>
    <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
    <BODY><h2>Length Required</h2>
    <hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>

    Sunday, May 9, 2021 5:36 AM

All replies

  • User475983607 posted

    The error state the content length header is missing in the HTTP request.  The 4XX HTTP statuses are malformed request errors.  The community can help if you share the code that caused the error.

    Sunday, May 9, 2021 10:22 AM
  • User753101303 posted


    For now you have a  411 Length Required - HTTP | MDN (mozilla.org) . Your intent is unclear. Do you try to send a chunked request or this is a test and you really just want to disable PUT requests ?

    Edit: if you really want to disable PUT a possible option could be to use filtering as shown at Verbs <verbs> | Microsoft Docs

    Sunday, May 9, 2021 11:38 AM
  • User1697794668 posted

    Yes, I just want to disable the put request. It should show method not allowed right? instead of 411

    Wednesday, May 12, 2021 6:58 AM
  • User753101303 posted

    You are using ASP.NET 4.x or Core? This is an MVC or an API controller? Some more context could help.

    Generally, you can use attributes such as  [HttpPost], [HttpPut] and so on to tell explicitly which that an action should respond to a given http verb. See earlier if you want to disable the PUT verb at the IIS level.

    Edit: I tested an [ApiController] with ASP.NET Core 5.x and it does show a 405 status code.

    Wednesday, May 12, 2021 7:45 PM