[英]Setting header in the Http Request
We are calling the Odata endpoint from our application.我们正在从我们的应用程序调用 Odata 端点。 The odata endpoint has few headers needed like below odata 端点需要的标头很少,如下所示
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如何设定的Prefer
,将设置maxpagesize可
只需使用方法Add
on DefaultRequestHeades
集合来添加自定义的。
client_Core.DefaultRequestHeades.Add("Prefer", "odata.maxpagesize=500")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.