One of the most common tasks in web development is to determine which HTTP verb your visitor has used to request a page. Is this an initial GET
request, or has the user POST
ed a form? In classic ASP or PHP, you will usually query the Server Variables collection (Request.ServerVariables("REQUEST_METHOD")
or $_Server['REQUEST_METHOD']
) to determine which verb was used, or you might query the Request.Form
collection for the presence or absence of values. The ASP.NET Web Forms and Web Pages frameworks provide convenience methods to differentiate between POST
and
Handler methods is a particularly nice feature introduced with the new ASP.NET Razor Pages framework . This feature enables you to determine what the user was doing when they requested the page, and to execute logic accordingly without having to resort to a bunch of conditional code.
Last updated:2021-02-22