Skip to content
chrissie1 edited this page Dec 26, 2012 · 3 revisions

The request object is used to send to the server and can be configured to your liking.

Accept

The accept property lets you set the type of hypermedia you want from the response. The field is a string but for your convenience there are also a bunch of constants you can use in the HttpContentypes class.

You use it like this.

http.Request.Accept = HttpContentTypes.ApplicationJson;

or you can also just write.

http.Request.Accept = "application/json";

This will ask the response to encode it's contents as JSON.

Here are the other type in HttpContenttypes.

  • MultiPartFormData = "multipart/form-data";
  • TextPlain = "text/plain";
  • TextHtml = "text/html";
  • TextCsv = "text/csv";
  • ApplicationJson = "application/json";
  • ApplicationXml = "application/xml";
  • ApplicationXWwwFormUrlEncoded = "application/x-www-form-urlencoded";
  • ApplicationOctetStream = "application/octet-stream";

AcceptCharSet

AcceptEncoding

AcceptLanguage

KeepAlive

ClientCertificates

ContentLength

ContentType

ContentEncoding

Cookies

Date

Expect

From

Host

IfMatch

IfModifiedSince

IfRange

MaxForwards

Referer

Range

UserAgent

RawHeaders

Method

Lets you get and set the HttpMethod that will be used by the Request.

This property is an enum named HttpMethod which contains the following methods.

  • HEAD
  • GET
  • POST
  • PUT
  • DELETE
  • OPTIONS
  • PATCH

This property will also be set depending on the method you use on the HttpClient

Data

Uri

PutFilename

MultiPartFormData

MultiPartFileData

Timeout

ParametersAsSegments

See Get for more information on why and how this is used.