Export (0) Print
Expand All
2 out of 3 rated this helpful - Rate this topic

HttpRequest.HttpMethod Property

Updated: June 2010

Gets the HTTP data transfer method (such as GET, POST, or HEAD) used by the client.

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)
public string HttpMethod { get; }

Property Value

Type: System.String
The HTTP data transfer method used by the client.

The following code example uses the HtmlEncode method to HTML-encode the value of the HttpMethod property and the WriteLine method to write the encoded value to the file. This code example is part of a larger example provided for the HttpRequest class.

// Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(Request.RequestType));
sw.WriteLine(Server.HtmlEncode(Request.UserHostAddress));
sw.WriteLine(Server.HtmlEncode(Request.UserHostName));
sw.WriteLine(Server.HtmlEncode(Request.HttpMethod));

Output produced by this code resembles the following example.

GET

127.0.0.1

127.0.0.1

GET

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

Date

History

Reason

June 2010

Added sample output for the code example.

Customer feedback.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.