ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 343
نمايش فراداده

HttpMethodAttribute

System.Web.Services.Protocols (system.web.services.dll)sealed class

This attribute is used to bind methods in an HttpGetClientProtocol or HttpPostClientProtocol proxy class to web service methods.

The ParameterFormatter property specifies how the proxy encodes parameters before sending them to a web service method. The ReturnFormatter property specifies how the proxy class decodes the web method''s return value. Both values must be set, as there is no default value. Set ReturnFormatter to the UrlParameterWriter type if you are using HTTP GET or the HtmlFormParameterWriter type if you are using HTTP POST. Always set ParameterFormatter to the XmlReturnReader type. An example attribute declaration for HTTP GET is <HttpMethodAttribute(GetType(XmlReturnReader), GetType(UrlParameterWriter))>.

public sealed class 

HttpMethodAttribute : Attribute { // Public Constructors public

HttpMethodAttribute ( ); public

HttpMethodAttribute (Type

returnFormatter , Type

parameterFormatter ); // Public Instance Properties public Type

ParameterFormatter {set; get; } public Type

ReturnFormatter {set; get; } }

Hierarchy

System.Object System.Attribute HttpMethodAttribute

Valid On

Method