How to pass user credentials to web service?

前端 未结 2 470
春和景丽
春和景丽 2020-12-29 11:38

I am consuming a webservice using WSDL in windows application. When I try to use method, i get the following error:-

The HTTP request is unauthorized

2条回答
  •  借酒劲吻你
    2020-12-29 12:13

    Here is the how it is working for me:-

    Config file setting looks like this:-

    
        
            
              
                
                  
                    
                    
                  
                
    
              
            
            
                
            
        
    
    

    and here i am passing user credentials:-

     var ser = new GetDataClient();
     ser.ClientCredentials.UserName.UserName = "userid";
     ser.ClientCredentials.UserName.Password = "Pa$$word1";
    

提交回复
热议问题