vitch
vitch

Reputation: 3214

System.Net.WebRequest doesn't have Accept property on monotouch

I'm trying to write some code for Monotouch which interfaces with a REST API which relies on the Accept header being set properly. If I try to do this in Monotouch I get the message:

Type 'System.Net.WebRequest' does not contain a definition for 'Request'...

Despite the fact that the property appears in the API docs.

It's only my first day with Monotouch so maybe I'm missing something obvious... Any ideas?

Upvotes: 2

Views: 7873

Answers (1)

poupou
poupou

Reputation: 43553

System.Net.WebRequest has no Accept property, never did, never will ;-)

You're likely missing a typecast to HttpWebRequest which does provide an Accept property (because it make sense for HTTP, not FTP, file...).

This is supported by MonoTouch but if it was not (e.g. another header) then you could try to use the Headers property to add it manually.

Upvotes: 9

Related Questions