简体   繁体   中英

How do I add an HTTP header to a web service call?

I'm calling a web service from a console app - all in C# on .NET.

I want to add an HTTP header (not a SOAP header) to the web service call. How do I do this?

This is what my code looks like so far:

EatService es = new EatService(); // web service added in Web References
// Add HTTP header X-Info = "extra info" here
string info = es.GetMoreInfo(); // ws call

如果您使用的是ASMX Web服务代理(Web参考),则这与将自定义Http标头添加到C#Web服务代理重复。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM