How to add custom Http Header for C# Web Service Client consuming Axis 1.4 Web service

前端 未结 7 1737
离开以前
离开以前 2020-11-29 20:33

I\'m trying to write a web service client in c# which the webservice is Java Axis 1.4. Axis service requires the Authorization: Basic Base64EncodedToken hea

相关标签:
7条回答
  • 2020-11-29 21:04

    I find this code and is resolve my problem.

    http://arcware.net/setting-http-header-authorization-for-web-services/

    protected override WebRequest GetWebRequest(Uri uri)
    {
        // Assuming authValue is set from somewhere, such as the config file
        HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(uri);
        request.Headers.Add("Authorization", string.Format("Basic {0}", authValue));
        return request;
    }
    
    0 讨论(0)
提交回复
热议问题