Where is the constant for "HttpRequest.RequestType" and "WebRequest.Method" values in .NET?

System.Net.WebRequestMethods.Http
    .Connect = "CONNECT"
    .Get = "GET"
    .Head = "HEAD"
    .MkCol = "MKCOL"
    .Post = "POST"
    .Put = "PUT"

Ultimately, though; since const expressions are burned into the caller, this is identical to using "GET" etc, just without the risk of a typo.


Also exists System.Net.Http.HttpMethod which can serve instead of enum. You can compare them aMethod == HttpMethod.Get, etc. To get string method name call e.g. HttpMethod.Get.Method.


In ASP.NET MVC they're in System.Web.Mvc.HttpVerbs. But all methods that take one of these enum values also has a text override, as there is no complete set of HTTP verbs, only a set of currently defined values (see here and here and here).

You can't create an enumeration that covers all verbs, as there is the possibility that verbs can be added, and enumerations have versioning issues that make this impractical.

Tags:

C#

.Net

Asp.Net