Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

.net

asp.net

I need to check the RequestType of an HttpRequest in ASP.NET (or WebRequest.Method). I know that I can just use the string values "POST" or "GET" for the request type, but I could have sworn there was a constant somewhere in some class in .NET that contained the values.

Out of curiosity I was wondering if anyone knew what class these string constants for GET and POST were in. I've tried searching online but I've had no luck, so I thought I'd ask here.

like image 402
Dan Herbert Avatar asked Nov 10 '08 13:11

Dan Herbert


1 Answers

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.

like image 116
Marc Gravell Avatar answered Oct 12 '22 01:10

Marc Gravell