trx
trx

Reputation: 2167

Setting header in the Http Request

We are calling the Odata endpoint from our application. The odata endpoint has few headers needed like below

enter image description here

I am able to add the content on to my application which calls the end point like below

               ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
                Uri uri = new Uri(BaseURL_Core);
                client_Core.BaseAddress = uri;
                client_Core.DefaultRequestHeaders.Accept.Clear();
                client_Core.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client_Core.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray_Core));

How to set here the Prefer that will set the maxpagesize

Upvotes: 1

Views: 472

Answers (1)

Paweł Łukasik
Paweł Łukasik

Reputation: 4163

Just use method Add on DefaultRequestHeades collection to add custom ones.

client_Core.DefaultRequestHeades.Add("Prefer", "odata.maxpagesize=500")

Upvotes: 1

Related Questions