Skip to main content
 首页 » 编程设计

c#之使用 XMLHTTPRequest header

2024年02月23日15txw1958

我在 javascript 上创建了以下请求:

this.XmlHttp.setRequestHeader("AgentGUID", AgentGUID); 

我如何使用它抛出 C# 网络服务? 请求到达以下 WebService:

[WebService(Namespace = "http://mysite.com/WebServices/Agent", Description = "Some description")] 
public class AgentService : WebService 
{ 
 
    [WebMethod(Description = "SomeDesc.", MessageName = "LoginRSA")] 
    public LoginResult LoginRSA(string loginId, string password, string tenant) 
    { 
        // Here I want to consume request header 
    } 
} 

请您参考如下方法:

认为您必须查看以下属性。

HttpContext.Current.Request.Headers["AgentGUID"];