Having issue with authentication in case of WCF wshttpbinding -


i trying communicate wcf creating serviceclient class. surprisingly m able communicate wcf if pass wrong domain. happen if pass domain admin user. normal iisuser throws proper validation exception in case of wrong domain. test env. in different domain wcf hosted , can able communicate passing wrong domain remote machine(exist in diff domain).

in below code passing wrong domain name in "domainname" variable , domain admin user in "username" , works fine. how can make sure user has pass correct domain ?

 wshttpbinding httpbinding = new wshttpbinding();         httpbinding.name = "wshttpbinding_iservice";         httpbinding.closetimeout = timespan.maxvalue;         httpbinding.opentimeout = timespan.maxvalue;         httpbinding.receivetimeout = timespan.maxvalue;         httpbinding.sendtimeout = timespan.maxvalue;         httpbinding.bypassproxyonlocal = false;         httpbinding.transactionflow = false;         httpbinding.hostnamecomparisonmode = hostnamecomparisonmode.strongwildcard;         httpbinding.maxbufferpoolsize = convert.toint64("2147483646");         httpbinding.maxreceivedmessagesize = convert.toint64("2147483646");         httpbinding.messageencoding = wsmessageencoding.mtom;         httpbinding.textencoding = encoding.utf8;         httpbinding.usedefaultwebproxy = true;         httpbinding.allowcookies = false;          httpbinding.reliablesession.ordered = true;         httpbinding.reliablesession.inactivitytimeout = timespan.maxvalue;         httpbinding.reliablesession.enabled = false;          if (serverurl.tolower().contains("https://"))             httpbinding.security.mode = securitymode.transport;         else             httpbinding.security.mode = securitymode.message;          httpbinding.security.transport.clientcredentialtype = httpclientcredentialtype.windows;         httpbinding.security.transport.proxycredentialtype = httpproxycredentialtype.none;         httpbinding.security.transport.realm = "";           httpbinding.security.message.clientcredentialtype = messagecredentialtype.windows;         httpbinding.security.message.negotiateservicecredential = true;         httpbinding.security.message.algorithmsuite = system.servicemodel.security.securityalgorithmsuite.default;          endpointaddress endpoint = new endpointaddress(new uri(serverurl + "/service/myservice.svc"), endpointidentity.creatednsidentity("localhost"));         serviceclient _serviceclient = new serviceclient(httpbinding, endpoint);         _serviceclient.clientcredentials.windows.allowedimpersonationlevel = system.security.principal.tokenimpersonationlevel.impersonation;         _serviceclient.clientcredentials.windows.clientcredential.domain = domainname;         _serviceclient.clientcredentials.windows.clientcredential.username = username;         _serviceclient.clientcredentials.windows.clientcredential.password = password;         _serviceclient.open();         string cnfgrbinstalled = _serviceclient.getaccesstoken();            _serviceclient.close(); 


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -