c# - 如何将 HTTP header 添加到 Web 服务调用?

标签 c# .net web-services http-headers

我正在从控制台应用程序调用 Web 服务 - 全部使用 C# on .NET。

我想向 Web 服务调用添加 HTTP header (而不是 SOAP header )。我该怎么做?

到目前为止,这是我的代码的样子:

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 网络服务代理(网络引用),则这是 Adding Custom Http Headers to C# Web Service Proxy 的副本.

关于c# - 如何将 HTTP header 添加到 Web 服务调用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1314722/

相关文章:

c# - iOS Row Selected 未被调用

java - .NET 和 Java 产生不同的签名

java - 我们可以在 Tomcat 8 上通过 Jersey 实现没有 maven 和 web.xml 的 restful web 服务吗

css - 我应该使用哪些 CSS 选择器来设计我的 JSP。 ID 还是类?

c# - IE 想要下载 JSON 结果....MVC3

c# - .NET C# 中的集合操作

c# - Visual Studio Web Api 中的 Javascript

c# - 如何通过列表属性将对象拆分为对象列表 C#

.net - 如何从线程中捕获异常?

c# - 处理不正确的 HTTP header 正文大小值?