public NTLMWebServiceSoapClient(EndpointConfiguration endpointConfiguration) : base(NTLMWebServiceSoapClient.GetBindingForEndpoint(endpointConfiguration), NTLMWebServiceSoapClient.GetEndpointAddress(endpointConfiguration)) { this.Endpoint.Name = endpointConfiguration.ToString(); //this.ChannelFactory.Credentials.UserName.UserName = "******"; //this.ChannelFactory.Credentials.UserName.Password = "******"; this.ChannelFactory.Credentials.Windows.ClientCredential = new System.Net.NetworkCredential("edwardzh", "Ed@1122"); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public async Task <IActionResult> About() { SafeAccessTokenHandle safeAccessTokenHandle; bool returnValue = LogonUser("edwardzh", "wicresoft", "Ed@1122", LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, out safeAccessTokenHandle); WindowsIdentity.RunImpersonated(safeAccessTokenHandle, () => { NTLMWebServiceSoapClient client = new NTLMWebServiceSoapClient(NTLMWebServiceSoapClient.EndpointConfiguration.NTLMWebServiceSoap); var result = client.HelloWorldAsync().Result; ViewData["Message"] = result.Body.HelloWorldResult; }); return(View()); }
public NTLMWebServiceSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : base(NTLMWebServiceSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }